Add beacon filter for channel width change in VHT operation IE

Add support for handling the channel width change in VHT operation
IE. Updates the channel width whenever AP advertises the change in
channel width in VHT operation IE in the beacon.

Change-Id: I21aeb33dd039065051f9f0c69ad8f208d3950b92
CRs-Fixed: 496042
diff --git a/CORE/MAC/src/pe/sch/schBeaconProcess.c b/CORE/MAC/src/pe/sch/schBeaconProcess.c
index 16a0a0a..df2785b 100644
--- a/CORE/MAC/src/pe/sch/schBeaconProcess.c
+++ b/CORE/MAC/src/pe/sch/schBeaconProcess.c
@@ -1,44 +1,28 @@
 /*
- * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
+  * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+  *
+  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+  *
+  *
+  * Permission to use, copy, modify, and/or distribute this software for
+  * any purpose with or without fee is hereby granted, provided that the
+  * above copyright notice and this permission notice appear in all
+  * copies.
+  *
+  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+  * PERFORMANCE OF THIS SOFTWARE.
+*/
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
+* Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
+* All Rights Reserved.
+* Qualcomm Atheros Confidential and Proprietary.
+*/
 
 /*
  * Airgo Networks, Inc proprietary. All rights reserved.
@@ -354,6 +338,7 @@
     tpSirMacMgmtHdr    pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
     tANI_U16  aid;
     tANI_U8  operMode;
+    tANI_U8  chWidth = 0;
 #endif
 
 
@@ -488,17 +473,24 @@
     }
 
 #ifdef WLAN_FEATURE_11AC
-    if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ) 
+    if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
+        (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
+        (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE))
     {
         // check for VHT capability
-        if(psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
+        pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid,
+                                    &psessionEntry->dph.dphHashTable);
+        if (psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
         {
-            pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid, &psessionEntry->dph.dphHashTable);
-            operMode = pStaDs->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pStaDs->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
-            if( operMode != pBeacon->OperatingMode.chanWidth)
+            operMode = pStaDs->vhtSupportedChannelWidthSet ?
+                       eHT_CHANNEL_WIDTH_80MHZ :
+                       pStaDs->htSupportedChannelWidthSet ?
+                       eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
+            if (operMode != pBeacon->OperatingMode.chanWidth)
             {
-                PELOG1(limLog(pMac, LOG1, FL(" received Chanwidth %d, staIdx = %d"),
-                                          pBeacon->OperatingMode.chanWidth, 
+                PELOG1(limLog(pMac, LOG1,
+                              FL(" received OpMode Chanwidth %d, staIdx = %d"),
+                                          pBeacon->OperatingMode.chanWidth,
                                           pStaDs->staIndex);)
                 PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
                                           pMh->sa[0],
@@ -507,23 +499,88 @@
                                           pMh->sa[3],
                                           pMh->sa[4],
                                           pMh->sa[5]);)
-                
-                if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
+
+                if (pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
                 {
-                    pStaDs->vhtSupportedChannelWidthSet =  WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
-                    pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
-                }
-                else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
-                {
-                    pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
+                    PELOG1(limLog(pMac, LOG1,
+                                 FL("Updating the CH Width to 80MHz"));)
+                    pStaDs->vhtSupportedChannelWidthSet =
+                                         WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
                     pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
                 }
-                else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
+                else if (pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
                 {
-                    pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
+                    PELOG1(limLog(pMac, LOG1,
+                                  FL("Updating the CH Width to 40MHz"));)
+                    pStaDs->vhtSupportedChannelWidthSet =
+                                             WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
+                    pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
+                }
+                else if (pBeacon->OperatingMode.chanWidth ==
+                                eHT_CHANNEL_WIDTH_20MHZ)
+                {
+                    PELOG1(limLog(pMac, LOG1,
+                                  FL("Updating the CH Width to 20MHz"));)
+                    pStaDs->vhtSupportedChannelWidthSet =
+                                            WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
                     pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
                 }
-                limCheckVHTOpModeChange(pMac, psessionEntry, pBeacon->OperatingMode.chanWidth, pStaDs->staIndex); 
+                limCheckVHTOpModeChange(pMac, psessionEntry,
+                                        pBeacon->OperatingMode.chanWidth,
+                                        pStaDs->staIndex);
+            }
+        }
+        else if (psessionEntry->vhtCapability && pBeacon->VHTOperation.present)
+        {
+            operMode = pStaDs->vhtSupportedChannelWidthSet;
+            if (operMode != pBeacon->VHTOperation.chanWidth)
+            {
+                PELOG1(limLog(pMac, LOG1,
+                       FL(" received VHTOP CHWidth %d staIdx = %d"),
+                                          pBeacon->VHTOperation.chanWidth,
+                                          pStaDs->staIndex);)
+                PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
+                                          pMh->sa[0],
+                                          pMh->sa[1],
+                                          pMh->sa[2],
+                                          pMh->sa[3],
+                                          pMh->sa[4],
+                                          pMh->sa[5]);)
+
+                if (pBeacon->VHTOperation.chanWidth ==
+                                WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
+                {
+                    PELOG1(limLog(pMac, LOG1,
+                                  FL("Updating the CH Width to 80MHz"));)
+                    pStaDs->vhtSupportedChannelWidthSet =
+                                                 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
+                    pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
+                    chWidth = eHT_CHANNEL_WIDTH_80MHZ;
+                }
+                else if (pBeacon->VHTOperation.chanWidth ==
+                                WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
+                {
+                    pStaDs->vhtSupportedChannelWidthSet =
+                            WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
+                    if (pBeacon->HTCaps.supportedChannelWidthSet)
+                    {
+                        PELOG1(limLog(pMac, LOG1,
+                                      FL("Updating the CH Width to 40MHz"));)
+                        pStaDs->htSupportedChannelWidthSet =
+                                                     eHT_CHANNEL_WIDTH_40MHZ;
+                        chWidth = eHT_CHANNEL_WIDTH_40MHZ;
+                    }
+                    else
+                    {
+                        PELOG1(limLog(pMac, LOG1,
+                                      FL("Updating the CH Width to 20MHz"));)
+                        pStaDs->htSupportedChannelWidthSet =
+                                                     eHT_CHANNEL_WIDTH_20MHZ;
+                        chWidth = eHT_CHANNEL_WIDTH_20MHZ;
+                    }
+                }
+                limCheckVHTOpModeChange(pMac, psessionEntry,
+                                chWidth, pStaDs->staIndex);
             }
         }
     }