Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9113aeea authored by Arun Kumar Khandavalli's avatar Arun Kumar Khandavalli Committed by Gerrit - the friendly Code Review server
Browse files

wlan: Add support to create/destroy sme session from iff_up/down

Add support to create and destroy sme sessions from interface up
and down.

Change-Id: Ie00dd5e05d3b88a20d2e86099453f0770f5c5615
CRs-Fixed: 2632602
parent 18303eb1
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -443,7 +443,6 @@ VOS_STATUS hdd_enter_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter)
VOS_STATUS hdd_exit_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter)
{
   VOS_STATUS vosStatus;
   eHalStatus halStatus;

   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
      "%s: calling hdd_set_sme_config",__func__);
@@ -480,24 +479,8 @@ VOS_STATUS hdd_exit_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter)
      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%08x]",
                    halStatus, halStatus );
      goto err_voss_stop;

   }

   pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE;

   //Trigger the initial scan
   hdd_wlan_initial_scan(pAdapter);

   return VOS_STATUS_SUCCESS;

err_voss_stop:
+60 −7
Original line number Diff line number Diff line
@@ -174,19 +174,64 @@ safeChannelType safeChannels[NUM_20MHZ_RF_CHANNELS] =
int __hdd_hostapd_open (struct net_device *dev)
{
   hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
   hdd_context_t *pHddCtx;
   VOS_STATUS status;
   v_BOOL_t in_standby = TRUE;
   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;

   ENTER();

   if(!test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))
   {
       //WMM_INIT OR BSS_START not completed
       hddLog( LOGW, "Ignore hostadp open request");
       EXIT();
   if (test_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags)) {
          hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: session already opened for the adapter",
                 __func__);
          return 0;
   }

   MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                    TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST, NO_SESSION, 0));
   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST,
                    pAdapter->sessionId, pAdapter->device_mode));
   if (NULL == pHddCtx)
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
         "%s: HDD context is Null", __func__);
      return -ENODEV;
   }
   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
   while ( (NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status) )
   {
      if (test_bit(DEVICE_IFACE_OPENED, &pAdapterNode->pAdapter->event_flags))
      {
         hddLog(VOS_TRACE_LEVEL_INFO, "%s: chip already out of standby",
                __func__);
         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;
       }
   }

   status = hdd_init_ap_mode( pAdapter, false);
   if( VOS_STATUS_SUCCESS != status ) {
          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to create session for station mode",
                 __func__);
          return -EINVAL;
   }

   set_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags);

   //Turn ON carrier state
   netif_carrier_on(dev);
   //Enable all Tx queues
@@ -239,6 +284,14 @@ int __hdd_hostapd_stop (struct net_device *dev)
   //Turn OFF carrier state
   netif_carrier_off(dev);

  if (test_bit(SME_SESSION_OPENED, &adapter->event_flags)) {
     hdd_stop_adapter(hdd_ctx, adapter, VOS_TRUE);
     hdd_deinit_adapter(hdd_ctx, adapter, TRUE);
  }

 clear_bit(DEVICE_IFACE_OPENED, &adapter->event_flags);
 adapter->dev->wireless_handlers = NULL;

   if (!hdd_is_cli_iface_up(hdd_ctx))
       sme_ScanFlushResult(hdd_ctx->hHal, 0);

+19 −12
Original line number Diff line number Diff line
@@ -8065,6 +8065,12 @@ int __hdd_open(struct net_device *dev)
      return -ENODEV;
   }
   if (test_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags)) {
          hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: session already opened for the adapter",
                 __func__);
          return 0;
   }
   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
   while ( (NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status) )
   {
@@ -8092,6 +8098,13 @@ int __hdd_open(struct net_device *dev)
       }
   }
   status = hdd_init_station_mode( pAdapter );
   if( VOS_STATUS_SUCCESS != status ) {
          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to create session for station mode",
                 __func__);
          return -EINVAL;
   }
   set_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags);
   if (hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) 
   {
@@ -8264,8 +8277,6 @@ int __hdd_stop (struct net_device *dev)
       wlan_hdd_stop_mon(pHddCtx, true);
   }
   /* Make sure the interface is marked as closed */
   clear_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags);
   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disabling OS Tx queues", __func__);
   /* Disable TX on the interface, after this hard_start_xmit() will not
@@ -8286,7 +8297,8 @@ int __hdd_stop (struct net_device *dev)
    * Notice that the hdd_stop_adapter is requested not to close the session
    * That is intentional to be able to scan if it is a STA/P2P interface
    */
   hdd_stop_adapter(pHddCtx, pAdapter, VOS_FALSE);
   hdd_stop_adapter(pHddCtx, pAdapter, VOS_TRUE);
   clear_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags);
#ifdef FEATURE_WLAN_TDLS
   mutex_lock(&pHddCtx->tdls_lock);
#endif
@@ -8339,6 +8351,8 @@ int __hdd_stop (struct net_device *dev)
       }
   }
   pAdapter->dev->wireless_handlers = NULL;
   /*
    * Upon wifi turn off, DUT has to flush the scan results so if
    * this is the last cli iface, flush the scan database.
@@ -9836,9 +9850,6 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
#endif
         hdd_initialize_adapter_common(pAdapter);
         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 )
@@ -9895,16 +9906,12 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
         pAdapter->device_mode = session_type;
         hdd_initialize_adapter_common(pAdapter);
         status = hdd_init_ap_mode(pAdapter, false);
         if( VOS_STATUS_SUCCESS != status )
            goto err_free_netdev;
         status = hdd_sta_id_hash_attach(pAdapter);
         if (VOS_STATUS_SUCCESS != status)
         {
             hddLog(VOS_TRACE_LEVEL_FATAL,
                    FL("failed to attach hash for session %d"), session_type);
             hdd_deinit_adapter(pHddCtx, pAdapter, rtnl_held);
             goto err_free_netdev;
         }