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", __func__);
        sme_ReleaseGlobalLock( &pMac->sme );
        return eHAL_STATUS_FAILURE;
    }

#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
    smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d",
        pMac->ft.ftSmeContext.FTState);
#endif

    // Global Station FT State
    switch(pMac->ft.ftSmeContext.FTState)
    {
    case eFT_SET_KEY_WAIT:
#ifdef DEBUG_ROAM_DELAY
    //store the PTK send event
    vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
#endif
    if (sme_GetFTPreAuthState (hHal) == TRUE)
      {
          status = sme_FTSendUpdateKeyInd(pMac, pFTKeyInfo);
          if (status != 0 )
          {
              smsLog( pMac, LOGE, "%s: Key set failure %d", __func__,
                      status);
              pMac->ft.ftSmeContext.setFTPTKState = FALSE;
              status = eHAL_STATUS_FT_PREAUTH_KEY_FAILED;
          }
          else
          {
              pMac->ft.ftSmeContext.setFTPTKState = TRUE;
              status = eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS;
              smsLog( pMac, LOG1, "%s: Key set success", __func__);
          }
          sme_SetFTPreAuthState(hHal, FALSE);
      }
      pMac->ft.ftSmeContext.FTState = eFT_START_READY;
#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
      smsLog( pMac, LOG1, "%s: state changed to %d status %d", __func__,
              pMac->ft.ftSmeContext.FTState, status);
#endif
       break;
          
    default:
       smsLog( pMac, LOGE, "%s: Unhandled state=%d", __func__,
               pMac->ft.ftSmeContext.FTState);
       status = eHAL_STATUS_FAILURE;
       break;
    }
    sme_ReleaseGlobalLock( &pMac->sme );

    return status;
}
Exemple #2
0
eHalStatus sme_FTUpdateKey(tHalHandle hHal, tANI_U32 sessionId,
                           tCsrRoamSetKey * pFTKeyInfo )
{
   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
   tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
   eHalStatus status = eHAL_STATUS_FAILURE;

   if (!pSession)
   {
      smsLog( pMac, LOGE, FL("pSession is NULL"));
      return eHAL_STATUS_FAILURE;
   }

   if (pFTKeyInfo == NULL)
   {
      smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL", __func__);
      return eHAL_STATUS_FAILURE;
   }

   status = sme_AcquireGlobalLock( &pMac->sme );
   if (!( HAL_STATUS_SUCCESS( status )))
   {
      return eHAL_STATUS_FAILURE;
   }

#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
   smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d",
         pSession->ftSmeContext.FTState);
#endif

   // Global Station FT State
   switch(pSession->ftSmeContext.FTState)
   {
      case eFT_SET_KEY_WAIT:
         if (sme_GetFTPreAuthState(hHal, sessionId) == TRUE)
         {
            status = sme_FTSendUpdateKeyInd(pMac, sessionId, pFTKeyInfo);
            if (status != 0 )
            {
               smsLog( pMac, LOGE, "%s: Key set failure %d", __func__,
                     status);
               pSession->ftSmeContext.setFTPTKState = FALSE;
               status = eHAL_STATUS_FT_PREAUTH_KEY_FAILED;
            }
            else
            {
               pSession->ftSmeContext.setFTPTKState = TRUE;
               status = eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS;
               smsLog( pMac, LOG1, "%s: Key set success", __func__);
            }
            sme_SetFTPreAuthState(hHal, sessionId, FALSE);
         }

         pSession->ftSmeContext.FTState = eFT_START_READY;
#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
         smsLog( pMac, LOG1, "%s: state changed to %d status %d", __func__,
               pSession->ftSmeContext.FTState, status);
#endif
         break;

      default:
         smsLog( pMac, LOGW, "%s: Unhandled state=%d", __func__,
               pSession->ftSmeContext.FTState);
         status = eHAL_STATUS_FAILURE;
         break;
   }
   sme_ReleaseGlobalLock( &pMac->sme );

   return status;
}