wlan: Sessionization of PMC/PMM module messages

Sessionization of  PMC/PMM module messages for:
UAPSD, WOWL, HostOffload, Set packet filter, Clear packet filter
Host changes to support SLM SESSIONIZATION

Change-Id: Ie4f5554a9fd78df7641e8c9496444d40f6eddd31
CR-Fixed: 382845, 400362, 402982, 402585
diff --git a/CORE/HDD/src/wlan_hdd_wowl.c b/CORE/HDD/src/wlan_hdd_wowl.c
index f581d99..f0b8f91 100644
--- a/CORE/HDD/src/wlan_hdd_wowl.c
+++ b/CORE/HDD/src/wlan_hdd_wowl.c
@@ -49,8 +49,6 @@
  * 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)
@@ -111,12 +109,14 @@
   @return     : FALSE if any errors encountered
               : TRUE otherwise
   ===========================================================================*/
-v_BOOL_t hdd_add_wowl_ptrn (const char * ptrn) 
+v_BOOL_t hdd_add_wowl_ptrn (hdd_adapter_t *pAdapter, const char * ptrn) 
 {
   tSirWowlAddBcastPtrn localPattern;
   int i, first_empty_slot, len, offset;
   eHalStatus halStatus;
   const char *temp;
+  tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+  v_U8_t sessionId = pAdapter->sessionId;
 
   len = find_ptrn_len(ptrn);
 
@@ -243,7 +243,7 @@
     localPattern.ucPatternByteOffset = 0;
 
     // Register the pattern downstream
-    halStatus = sme_WowlAddBcastPattern( pAdapterHandle->hHal, &localPattern );
+    halStatus = sme_WowlAddBcastPattern( hHal, &localPattern, sessionId );
     if ( !HAL_STATUS_SUCCESS( halStatus ) )
     {
       // Add failed, so invalidate the local storage
@@ -277,12 +277,14 @@
   @return     : FALSE if any errors encountered
               : TRUE otherwise
   ===========================================================================*/
-v_BOOL_t hdd_del_wowl_ptrn (const char * ptrn) 
+v_BOOL_t hdd_del_wowl_ptrn (hdd_adapter_t *pAdapter, const char * ptrn) 
 {
   tSirWowlDelBcastPtrn delPattern;
   unsigned char id;
+  tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
   v_BOOL_t patternFound = VOS_FALSE;
   eHalStatus halStatus;
+  v_U8_t sessionId = pAdapter->sessionId;
 
   // Detect pattern
   for (id=0; id<WOWL_MAX_PTRNS_ALLOWED && g_hdd_wowl_ptrns[id] != NULL; id++)
@@ -298,7 +300,7 @@
   if(patternFound)
   {
     delPattern.ucPatternId = id;
-    halStatus = sme_WowlDelBcastPattern( pAdapterHandle->hHal, &delPattern );
+    halStatus = sme_WowlDelBcastPattern( hHal, &delPattern, sessionId );
     if ( HAL_STATUS_SUCCESS( halStatus ) )
     {
       // Remove from local storage as well
@@ -327,6 +329,7 @@
 {
   tSirSmeWowlEnterParams wowParams;
   eHalStatus halStatus;
+  tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
   wowParams.ucPatternFilteringEnable = enable_pbm;
   wowParams.ucMagicPktEnable = enable_mp;
@@ -337,8 +340,8 @@
   }
 
   // Request to put Libra into WoWL
-  halStatus = sme_EnterWowl( pAdapterHandle->hHal, hdd_wowl_callback, 
-      pAdapterHandle, &wowParams );
+  halStatus = sme_EnterWowl( hHal, hdd_wowl_callback, 
+                             pAdapter, &wowParams, pAdapter->sessionId);
 
   if ( !HAL_STATUS_SUCCESS( halStatus ) )
   {
@@ -359,11 +362,12 @@
   @return           : FALSE if any errors encountered
                     : TRUE otherwise
   ===========================================================================*/
-v_BOOL_t hdd_exit_wowl (void) 
+v_BOOL_t hdd_exit_wowl (hdd_adapter_t*pAdapter) 
 {
+  tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
   eHalStatus halStatus;
 
-  halStatus = sme_ExitWowl( pAdapterHandle->hHal );
+  halStatus = sme_ExitWowl( hHal );
   if ( !HAL_STATUS_SUCCESS( halStatus ) )
   {
     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -381,14 +385,15 @@
   @return           : FALSE if any errors encountered
                     : TRUE otherwise
   ===========================================================================*/
-v_BOOL_t hdd_init_wowl (void *pAdapter) 
+v_BOOL_t hdd_init_wowl (hdd_adapter_t*pAdapter) 
 {
-  pAdapterHandle = (struct hdd_context_s*)pAdapter;
+  hdd_context_t *pHddCtx = NULL;
+  pHddCtx = pAdapter->pHddCtx;
 
   memset(g_hdd_wowl_ptrns, 0, sizeof(g_hdd_wowl_ptrns));
 
   //Add any statically configured patterns 
-  hdd_add_wowl_ptrn(pAdapterHandle->cfg_ini->wowlPattern); 
+  hdd_add_wowl_ptrn(pAdapter, pHddCtx->cfg_ini->wowlPattern); 
 
   return VOS_TRUE;
 }