P2P: Defer IMPS for configured gDeferIMPStime value.

Defer entering into IMPS mode for the duration of configured
gDeferIMPStime if any command is processed.

To disable deferring IMPS, configure variable gDeferIMPStime
must be set to 0. By default it is 200ms and maximum value
500ms can be configured.

Change-Id: I32ed20875954b884d637f40ea9c520538c4d5cd1
CRs-Fixed: 657916
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 50d7b4d..51ac7fb 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -796,6 +796,16 @@
                     // Insert the command onto the ActiveList...
                     csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
 
+                    if( pMac->deferImps )
+                    {
+                        /* IMPS timer is already running so stop it and
+                         * it will get restarted when no command is pending
+                         */
+                        csrScanStopIdleScanTimer( pMac );
+                        pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
+                        pMac->deferImps = eANI_BOOLEAN_FALSE;
+                    }
+
                     // .... and process the command.
 
                     MTRACE(vos_trace(VOS_MODULE_ID_SME,
@@ -1411,6 +1421,8 @@
    pMac->isCoalesingInIBSSAllowed =
          pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
    pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
+   pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
+
    return status;
 }