Merge "wlan: Negate the keys if DISA is supported"
diff --git a/CORE/MAC/src/include/sysGlobal.h b/CORE/MAC/src/include/sysGlobal.h
index c21aa3c..7f26e9b 100644
--- a/CORE/MAC/src/include/sysGlobal.h
+++ b/CORE/MAC/src/include/sysGlobal.h
@@ -34,6 +34,7 @@
 
     tANI_U32 gSysFrameCount[4][16];
     tANI_U32 gSysBbtReceived;
+    tANI_U32 gSysBbtPendingMgmtCount;
     tANI_U32 gSysBbtPostedToLim;
     tANI_U32 gSysBbtPostedToSch;
     tANI_U32 gSysBbtPostedToPmm;
@@ -49,6 +50,7 @@
     tANI_U32 gSysEnableLearnMode;
     tANI_U32 gSysEnableScanMode;
     tANI_U32 gSysEnableLinkMonitorMode;
+    vos_spin_lock_t lock;
 } tAniSirSys, *tpAniSirSys;
 
 #endif
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c
index e863950..83deb18 100644
--- a/CORE/MAC/src/pe/lim/limApi.c
+++ b/CORE/MAC/src/pe/lim/limApi.c
@@ -991,6 +991,7 @@
         return eSIR_SUCCESS;
     pMac->lim.maxBssId = pMacOpenParam->maxBssId;
     pMac->lim.maxStation = pMacOpenParam->maxStation;
+    vos_spin_lock_init( &pMac->sys.lock );
 
     if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
     {
@@ -1087,7 +1088,9 @@
 
     if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
         return eSIR_SUCCESS;
-    
+
+    vos_spin_lock_destroy( &pMac->sys.lock );
+
     for(i =0; i < pMac->lim.maxBssId; i++)
     {
         if(pMac->lim.gpSession[i].valid == TRUE)
@@ -1339,7 +1342,7 @@
     return eSIR_SUCCESS;
 }
 
-
+#define RSRVD_MGMT_RX_PACKETS 10
 
 // ---------------------------------------------------------------------------
 /**
@@ -1413,6 +1416,30 @@
     msg.bodyptr = vosBuff;
     msg.bodyval = 0;
 
+    vos_spin_lock_acquire( &pMac->sys.lock );
+    if( pMac->sys.gSysBbtPendingMgmtCount > (vos_pkt_get_num_of_rx_raw_pkts()/4) )
+    {
+        vos_spin_lock_release( &pMac->sys.lock );
+        // drop all management packets
+        vos_pkt_return_packet(pVosPkt);
+        return  VOS_STATUS_SUCCESS;
+    }
+
+    if( pMac->sys.gSysBbtPendingMgmtCount > ( vos_pkt_get_num_of_rx_raw_pkts()/4
+                                              - RSRVD_MGMT_RX_PACKETS ))
+    {
+        // drop all probereq, proberesp and beacons
+        if( mHdr->fc.subType == SIR_MAC_MGMT_BEACON ||  mHdr->fc.subType ==
+            SIR_MAC_MGMT_PROBE_REQ ||  mHdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP )
+        {
+            vos_spin_lock_release( &pMac->sys.lock );
+            vos_pkt_return_packet(pVosPkt);
+            return  VOS_STATUS_SUCCESS;
+        }
+    }
+    pMac->sys.gSysBbtPendingMgmtCount++;
+    vos_spin_lock_release( &pMac->sys.lock );
+
     if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
                                                   &msg,
                                                   mHdr->fc.type,
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index 7c4cd6e..4f9339d 100644
--- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -1370,7 +1370,9 @@
 #ifdef WLAN_DEBUG                
             pMac->lim.numBbt++;
 #endif
-
+            vos_spin_lock_acquire( &pMac->sys.lock );
+            pMac->sys.gSysBbtPendingMgmtCount--;
+            vos_spin_lock_release( &pMac->sys.lock );
             {
                 v_U16_t     pktLen = 0;
                 vos_pkt_t  *pVosPkt;