wlan : Fast transition (11r)

- eHAL_STATUS_FT_PREAUTH_KEY_WAIT is added to defer key
 updation until reassociation completes using Fast
 Transition using 11r
- Enable support for RIC
- Config support for 11r in kbuild, disabled by default in CRM
builds till supplicant changes get merged

Change-Id: Id5e44c985656aa00f243c5ca355b877b3febc7ba
CRs-fixed: 434525
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index 5111f44..201786b 100755
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -400,32 +400,28 @@
 #endif
 
 #if defined(CONFIG_CFG80211) && defined (KERNEL_SUPPORT_11R_CFG80211)
-    vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); 
-    vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); 
+    vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN);
+    vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN);
 
-    /* RIC TODO */
-    /*sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe, 
+    sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe,
                   DOT11F_IE_FTINFO_MAX_LEN, &ric_ies_length );
-    if (ric_ies_length == 0) 
+    if (ric_ies_length == 0)
     {
-        hddLog(LOGW, "%s: RIC IEs is of length 0 not sending RIC Information for now", __func__); 
+        hddLog(LOGW,
+              "%s: RIC IEs is of length 0 not sending RIC Information for now",
+              __func__);
     }
-    else
-    {
-        ftEvent.ric_ies = ricIe;
-        ftEvent.ric_ies_len = ric_ies_length;
-    }*/
 
     ftEvent.ric_ies = ricIe;
-    ftEvent.ric_ies_len = 0;
-    hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length); 
+    ftEvent.ric_ies_len = ric_ies_length;
+    hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length);
 
-    sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, 
+    sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe,
                 DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len);
 
-    if (auth_resp_len == 0) 
+    if (auth_resp_len == 0)
     {
-        hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); 
+        hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
         return;
     }
 
@@ -436,7 +432,7 @@
 
     hddLog(LOG1, "%s ftEvent.ies_len %d",__FUNCTION__, ftEvent.ies_len);
     hddLog(LOG1, "%s ftEvent.ric_ies_len  %d",__FUNCTION__, ftEvent.ric_ies_len );
-    hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ", 
+    hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ",
             __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1],
             ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4],
             ftEvent.target_ap[5]);
@@ -444,22 +440,24 @@
     (void)cfg80211_ft_event(dev, ftEvent);
 
 #else
-    // We need to send the IEs to the supplicant.
+    // We need to send the IEs to the supplicant
     buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
-    if (buff == NULL) 
+    if (buff == NULL)
     {
-        hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); 
+        hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
         return;
     }
-    vos_mem_zero(buff, IW_CUSTOM_MAX); 
+    vos_mem_zero(buff, IW_CUSTOM_MAX);
 
     // Sme needs to send the RIC IEs first 
     str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX);
-    sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), 
+    sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]),
             (IW_CUSTOM_MAX - str_len), &ric_ies_length );
-    if (ric_ies_length == 0) 
+    if (ric_ies_length == 0)
     {
-        hddLog(LOGW, "%s: RIC IEs is of length 0 not sending RIC Information for now", __func__); 
+        hddLog(LOGW,
+               "%s: RIC IEs is of length 0 not sending RIC Information for now",
+               __func__);
     }
     else
     {
@@ -468,14 +466,14 @@
     }
 
     // Sme needs to provide the Auth Resp
-    vos_mem_zero(buff, IW_CUSTOM_MAX); 
+    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);
+    sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len],
+                    (IW_CUSTOM_MAX - str_len), &auth_resp_len);
 
-    if (auth_resp_len == 0) 
+    if (auth_resp_len == 0)
     {
-        hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); 
+        hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
         return;
     }
 
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 3291493..ee4b5dd 100755
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3151,11 +3151,10 @@
 #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 */
-        /*TODO 11r - is this used?? */
         halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey);
-        if( halStatus == eHAL_STATUS_SUCCESS )
+        if( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_WAIT )
         {
-           return halStatus;
+           return -EINVAL;
         }
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 65659d1..c44dbd0 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -3142,9 +3142,9 @@
 /* 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 )
+    if( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_WAIT )
     {
-       return halStatus;
+       return -EINVAL;
     }
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
diff --git a/CORE/SME/src/sme_common/sme_FTApi.c b/CORE/SME/src/sme_common/sme_FTApi.c
index 5ab41b4..f9338f2 100644
--- a/CORE/SME/src/sme_common/sme_FTApi.c
+++ b/CORE/SME/src/sme_common/sme_FTApi.c
@@ -247,12 +247,6 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
             smsLog( pMac, LOG1, "ft_ies_length=%d state=%d", 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;
@@ -368,15 +362,15 @@
        return eHAL_STATUS_FAILURE;
     }
 
-    if (pFTKeyInfo == NULL) 
+    if (pFTKeyInfo == NULL)
     {
         smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL\n", __func__);
         sme_ReleaseGlobalLock( &pMac->sme );
-        return eHAL_STATUS_FAILURE; 
+        return eHAL_STATUS_FAILURE;
     }
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d", 
+    smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d",
         pMac->ft.ftSmeContext.FTState);
 #endif
 
@@ -384,9 +378,12 @@
     switch(pMac->ft.ftSmeContext.FTState)
     {
     case eFT_SET_KEY_WAIT:
-       status = eHAL_STATUS_SUCCESS;
-       //status = sme_FTSendUpdateKeyInd( hHal, pFTKeyInfo );
+       status = eHAL_STATUS_FT_PREAUTH_KEY_WAIT;
        pMac->ft.ftSmeContext.FTState = eFT_START_READY;
+#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
+       smsLog( pMac, LOG1, "%s: state changed to %d", __func__,
+               pMac->ft.ftSmeContext.FTState);
+#endif
        break;
           
     default:
diff --git a/CORE/WDA/inc/legacy/halTypes.h b/CORE/WDA/inc/legacy/halTypes.h
index e1b9b99..ebf292e 100644
--- a/CORE/WDA/inc/legacy/halTypes.h
+++ b/CORE/WDA/inc/legacy/halTypes.h
@@ -238,6 +238,10 @@
 
     eHAL_STATUS_SET_CHAN_ALREADY_ON_REQUESTED_CHAN,
 
+#ifdef WLAN_FEATURE_VOWIFI_11R
+    eHAL_STATUS_FT_PREAUTH_KEY_WAIT,
+#endif
+
     // not a real status.  Just a way to mark the maximum in the enum.
     eHAL_STATUS_MAX
 
diff --git a/Kbuild b/Kbuild
index 2b8bfed..c5d2150 100644
--- a/Kbuild
+++ b/Kbuild
@@ -31,6 +31,10 @@
 
 	#Flag to enable TDLS feature
 	CONFIG_QCOM_TDLS := y
+
+	#Flag to enable Fast Transition (11r) feature
+	CONFIG_QCOM_VOWIFI_11R := n
+
 endif
 
 # Feature flags which are not (currently) configurable via Kconfig