wlan: report correct max link-speed to UI.

Populate rate-flags as per assoc response frame and use those
flags when ini parameter 'gReportMaxLinkSpeed' is set to
eHDD_LINK_SPEED_REPORT_MAX.

Change-Id: I316fbb82c8dd1778dfed8c5125e076aa2cf49382
CRs-Fixed: 637266.
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index 4fa7b61..6f364a8 100644
--- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -198,6 +198,69 @@
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
+/**
+ * limGetMaxRateFlags()
+ *
+ *FUNCTION:
+ *This function is called by limSendSmeJoinReassocRsp get rateFlags.
+ *These rateflags are used when MAX link-speed need to be reported
+ *to UI.
+ *
+ *PARAMS:
+ * @param  pStaDs - Pointer to internal STA Datastructure
+ * @param  psessionEntry - Pointer to the session entry
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @return rateFlags
+ */
+tANI_U32 limGetMaxRateFlags(tpDphHashNode pStaDs, tpPESession psessionEntry)
+{
+    tANI_U32 rate_flags = 0;
+
+   if (NULL == psessionEntry)
+    {
+        return rate_flags;
+    }
+
+    if(!IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
+       !IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
+    {
+       rate_flags |= eHAL_TX_RATE_LEGACY;
+    }
+    else
+    {
+        if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
+        {
+            if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz )
+                rate_flags |= eHAL_TX_RATE_SGI;
+
+            if (pStaDs->htDsssCckRate40MHzSupport)
+                rate_flags |=eHAL_TX_RATE_HT40;
+            else
+                rate_flags |=eHAL_TX_RATE_HT20;
+        }
+#ifdef WLAN_FEATURE_11AC
+        if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
+        {
+            if (eHT_CHANNEL_WIDTH_80MHZ == pStaDs->vhtSupportedChannelWidthSet)
+                rate_flags |= eHAL_TX_RATE_VHT80;
+
+             if (eHT_CHANNEL_WIDTH_40MHZ == pStaDs->vhtSupportedChannelWidthSet)
+                 rate_flags |= eHAL_TX_RATE_VHT40;
+
+             if (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->vhtSupportedChannelWidthSet)
+                 rate_flags |= eHAL_TX_RATE_VHT20;
+        }
+#endif
+    }
+
+     return rate_flags;
+}
 
 /**
  * limSendSmeJoinReassocRsp()
@@ -303,6 +366,10 @@
                 pSirSmeJoinRsp->staId = pStaDs->staIndex;
                 pSirSmeJoinRsp->ucastSig   = pStaDs->ucUcastSig;
                 pSirSmeJoinRsp->bcastSig   = pStaDs->ucBcastSig;
+                pSirSmeJoinRsp->maxRateFlags =
+                                limGetMaxRateFlags(pStaDs, psessionEntry);
+                PELOGE(limLog(pMac, LOG1, FL("maxRateFlags: %x"),
+                                              pSirSmeJoinRsp->maxRateFlags);)
             }
         }
 
@@ -452,7 +519,6 @@
 } /*** end limSendSmeJoinReassocRsp() ***/
 
 
-
 /**
  * limSendSmeStartBssRsp()
  *
@@ -569,10 +635,6 @@
                 //This is the size of the message, subtracting the size of the pointer to ieFields
                 size += ieLen - sizeof(tANI_U32);
         }
-
-            
-
-        
     }
 
     pSirSmeRsp->messageType     = msgType;
@@ -604,10 +666,6 @@
     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