wlan: Replace VOS_BUG with SSR

Replace VOS_BUG with SSR in case of tx timeout, Thread Stuck
and sme out of buffer.

In Internal builds SSR is not enabled so this will lead to
same behaviour as VOS_BUG. In customer builds SSR is enabled
so the driver will recover from this condition using SSR
and will not cause crash.

Also if fatal events are enabled, once fatal event is completed
do SSR in case reason of fatal event is tx timeout, active
command timeout or sme out of buffer.

Change-Id: I8c97d842f1102eff2c6c7ce7d548c9403637cf8e
CRs-Fixed: 918901
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 375b20b..168a63e 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -476,8 +476,9 @@
         }
         else
         {
-           /* panic with out-of-command */
-           VOS_BUG(0);
+           vosTraceDumpAll(pMac,0,0,0,0);
+           /* Trigger SSR */
+           vos_wlanRestart();
         }
     }
 
diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
index 813f9b0..7a0618f 100644
--- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c
+++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
@@ -1157,7 +1157,7 @@
 			__func__, gwlan_logging.mcThreadStuckCount,
 			gwlan_logging.rxThreadStuckCount,
 			gwlan_logging.txThreadStuckCount);
-		VOS_BUG(0);
+		vos_wlanRestart();
 		return;
 	}
 
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
index d4d68a8..a74fdee 100644
--- a/CORE/VOSS/src/vos_api.c
+++ b/CORE/VOSS/src/vos_api.c
@@ -1729,6 +1729,13 @@
          is_fatal, indicator, reason_code);
     wlan_report_log_completion(is_fatal, indicator, reason_code);
 
+    /* Do ssr after reporting fatal event to recover from
+     * below conditions
+     */
+    if (WLAN_LOG_REASON_SME_COMMAND_STUCK == reason_code ||
+         WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF == reason_code ||
+         WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT == reason_code)
+         vos_wlanRestart();
 }
 
 /**
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 0e05858..d85b7d0 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -14076,7 +14076,7 @@
                      WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT,
                      FALSE, TRUE);
       else
-         VOS_BUG(0);
+         vos_wlanRestart();
 
       if( pAckTxComp )
       {