wlan: send source of DXE while sending DXE done indication to FW

After done with DXE, send source of DXE done indication to firmware
so that FW can differentiate source of DXE and also send valid
reason-code to upper-layer while sending done indication.

Change-Id: Ifa636a6190c36dcc9fedc06a5c2fa6b58ef274a7
CRs-Fixed: 909226
diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
index 65bd734..ff38214 100644
--- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c
+++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
@@ -1267,11 +1267,11 @@
 	}
 
 	switch (pkt_type) {
-	case LOG_PKT_TYPE_DATA_MGMT:
+	case WLAN_MGMT_FRAME_LOGS:
 		status = wlan_queue_data_mgmt_pkt_for_app(pPacket);
 		break;
 
-	case LOG_PKT_TYPE_FW_LOG:
+	case WLAN_FW_LOGS:
 		status = wlan_queue_fw_log_pkt_for_app(pPacket);
 		break;
 
@@ -1286,7 +1286,7 @@
 
 void wlan_process_done_indication(uint8 type, uint32 reason_code)
 {
-    if ((type == WLAN_QXDM_LOGGING) && (wlan_is_log_report_in_progress() == TRUE))
+    if ((type == WLAN_FW_LOGS) && (wlan_is_log_report_in_progress() == TRUE))
     {
         pr_info("%s: Setting LOGGER_FATAL_EVENT\n", __func__);
         set_bit(LOGGER_FATAL_EVENT_POST_MASK, &gwlan_logging.event_flag);
diff --git a/CORE/VOSS/inc/vos_trace.h b/CORE/VOSS/inc/vos_trace.h
index a0c32f7..1207a13 100644
--- a/CORE/VOSS/inc/vos_trace.h
+++ b/CORE/VOSS/inc/vos_trace.h
@@ -81,22 +81,14 @@
     
 } VOS_TRACE_LEVEL;
 
-enum {
-	LOG_PKT_TYPE_DATA_MGMT = 0x1,
-	LOG_PKT_TYPE_FW_LOG    = 0x2
-};
-
-
-
 /* Log types. These types are defined in mailbox*/
 typedef enum
 {
     WLAN_MGMT_FRAME_LOGS    = 0,
-    WLAN_QXDM_LOGGING       = 1,
+    WLAN_FW_LOGS            = 1,
     WLAN_FW_MEMORY_DUMP     = 2
 }FrameLoggingType;
 
-
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   ------------------------------------------------------------------------*/
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
index 5239b43..721e624 100644
--- a/CORE/VOSS/src/vos_api.c
+++ b/CORE/VOSS/src/vos_api.c
@@ -1840,7 +1840,6 @@
 
   \param pPacket - a pointer to a vos pkt to be queued
          pkt_type - type of pkt to be queued
-                    LOG_PKT_TYPE_DATA_MGMT - frame log i.e data/mgmt pkts
 
   \return VOS_STATUS_SUCCESS - the pkt has been successfully queued.
           VOS_STATUS_E_FAILURE - the pkt queue handler has reported
diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h
index 357007d..c66b092 100644
--- a/CORE/WDA/inc/wlan_qct_wda.h
+++ b/CORE/WDA/inc/wlan_qct_wda.h
@@ -2090,5 +2090,5 @@
 void WDA_SetEnableSSR(v_BOOL_t enableSSR);
 
 
-void WDA_FWLoggingDXEdoneInd(void);
+void WDA_FWLoggingDXEdoneInd(v_U32_t logType);
 #endif
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 89e77e5..9c2ea0d 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -14098,7 +14098,7 @@
       }
       case WDA_SEND_LOG_DONE_IND:
       {
-         WDA_FWLoggingDXEdoneInd();
+         WDA_FWLoggingDXEdoneInd(pMsg->bodyval);
          break;
       }
       case WDA_FATAL_EVENT_LOGS_REQ:
@@ -17643,9 +17643,16 @@
    return wdaStatus;
 }
 
-void WDA_FWLoggingDXEdoneInd(void)
+void WDA_FWLoggingDXEdoneInd(v_U32_t logType)
 {
-   WDI_FWLoggingDXEdoneInd(NULL);
+   WDI_Status status;
+   status = WDI_FWLoggingDXEdoneInd(logType);
+
+   if (WDI_STATUS_SUCCESS_SYNC != status)
+   {
+       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                 FL("Failure status %d"), status);
+   }
 }
 
  /*  FUNCTION    WDA_featureCapsExchange
diff --git a/CORE/WDA/src/wlan_qct_wda_ds.c b/CORE/WDA/src/wlan_qct_wda_ds.c
index 5f3dfba..6a7a71c 100644
--- a/CORE/WDA/src/wlan_qct_wda_ds.c
+++ b/CORE/WDA/src/wlan_qct_wda_ds.c
@@ -139,16 +139,17 @@
 }
 #endif /*WLAN_PERF*/
 
-void WDA_DS_RxLogCallback(void)
+void WDA_DS_RxLogCallback(v_U8_t logType)
 {
   vos_msg_t vosMessage;
 
-  vosMessage.bodyptr = NULL;
+  vosMessage.bodyval = (v_U32_t)logType;
   vosMessage.reserved = 0;
   vosMessage.type = WDA_SEND_LOG_DONE_IND;
-  if (VOS_STATUS_SUCCESS != vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ))
+  if (VOS_STATUS_SUCCESS != vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage )) {
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                "WLAN WDA:Posting DXE logging done indication failed" );
+  }
   return;
 }
 
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
index 679819c..1f78693 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -4115,8 +4115,9 @@
 
 typedef struct
 {
+   wpt_uint16 status;
+   wpt_uint16 doneIndicationForSource;
    wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
-   wpt_uint32 status;
    wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
 }WDI_FWLoggingDXEdoneIndInfoType;
 
@@ -11587,7 +11588,7 @@
 WDI_Status
 WDI_FWLoggingDXEdoneInd
 (
-  WDI_FWLoggingDXEdoneIndInfoType*    pwdiFWLoggingDXEdoneInd
+  wpt_uint32 logType
 );
 
 /**
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index 0587351..87da5b7 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -4245,7 +4245,7 @@
 WDI_Status
 WDI_FWLoggingDXEdoneInd
 (
-  WDI_FWLoggingDXEdoneIndInfoType*    pwdiFWLoggingDXEdoneInd
+  wpt_uint32    data
 )
 {
 
@@ -4267,8 +4267,8 @@
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_FW_LOGGING_DXE_DONE_IND;
-  wdiEventData.pEventData      = pwdiFWLoggingDXEdoneInd;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiFWLoggingDXEdoneInd);
+  wdiEventData.pEventData      = (void *)&data;
+  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
   wdiEventData.pCBfnc          = NULL;
   wdiEventData.pUserData       = NULL;
 
@@ -34586,6 +34586,7 @@
   tFWLoggingDxeDoneInd  *FWLoggingDxeDoneIndParams;
   WDI_DS_LoggingSessionType *pLoggingSession;
   WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
+  wpt_uint32 *pLogType;
 
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -34596,13 +34597,16 @@
   /*-------------------------------------------------------------------------
     Sanity check
   -------------------------------------------------------------------------*/
-  if (NULL == pEventData)
+  if (NULL == pEventData ||
+      NULL == pEventData->pEventData)
   {
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
              "%s: Invalid parameters", __func__);
       WDI_ASSERT(0);
       return WDI_STATUS_E_FAILURE;
   }
+  pLogType = (wpt_uint32 *)pEventData->pEventData;
+
   pLoggingSession = (WDI_DS_LoggingSessionType *)
                        WDI_DS_GetLoggingSession(WDI_DS_GetDatapathContext(
                                                   (void *)pWDICtx));
@@ -34630,6 +34634,7 @@
                  sizeof(FWLoggingDxeDoneIndParams->logBuffAddress[0]));
 
   FWLoggingDxeDoneIndParams->status = eHAL_STATUS_SUCCESS;
+  FWLoggingDxeDoneIndParams->doneIndicationForSource = (wpt_uint16)*pLogType;
 
   wpalMemoryCopy(&FWLoggingDxeDoneIndParams->logBuffLength,
                  &pLoggingSession->logBuffLength, MAX_NUM_OF_BUFFER *
diff --git a/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h b/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
index fea8be8..ba95c76 100644
--- a/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
+++ b/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
@@ -193,6 +193,7 @@
    wpt_uint8   logType;
    /* Indicate if Last segment of log is received*/
    wpt_boolean done;
+   wpt_uint16 reasonCode;
 } WDI_DS_LoggingSessionType;
 
 WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
@@ -214,7 +215,7 @@
 typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
 typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
 typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
-typedef void (*WDI_DS_RxLogCallback)(void);
+typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
 
 
 
diff --git a/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
index 5b799d9..806ac92 100644
--- a/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
+++ b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
@@ -535,7 +535,7 @@
   wpt_uint16                  usMPDUDOffset, usMPDULen;
   WDI_DS_RxMetaInfoType     *pRxMetadata;
   wpt_uint8                  isFcBd = 0;
-
+  WDI_DS_LoggingSessionType *pLoggingSession;
   tpSirMacFrameCtl  pMacFrameCtl;
   // Do Sanity checks
   if(NULL == pContext || NULL == pFrame){
@@ -545,7 +545,9 @@
   // Normal DMA transfer does not contain RxBD
   if (WDTS_CHANNEL_RX_FW_LOG == channel)
   {
-      wpalFwLogPktSerialize(pFrame);
+      pLoggingSession = (WDI_DS_LoggingSessionType *)
+                         WDI_DS_GetLoggingSession(pContext);
+      wpalFwLogPktSerialize(pFrame, pLoggingSession->logType);
 
       return eWLAN_PAL_STATUS_SUCCESS;
   }
@@ -882,6 +884,7 @@
 
   pLoggingSession->done = pLoggingMb->done;
   pLoggingSession->logType = pLoggingMb->logType;
+  pLoggingSession->reasonCode = pLoggingMb->reasonCode;
   // Done using Mailbox, zero out the memory.
   wpalMemoryZero(pLoggingMb, sizeof(tLoggingMailBox));
 
@@ -907,11 +910,14 @@
   }
   /* check for done and Log type Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
   if (pLoggingSession->done && pLoggingSession->logType <= VALID_FW_LOG_TYPES)
-     vos_process_done_indication(pLoggingSession->logType, 0);
+     vos_process_done_indication(pLoggingSession->logType,
+                                 pLoggingSession->reasonCode);
+
+  ((WDI_DS_ClientDataType *)(pContext))->rxLogCB(pLoggingSession->logType);
 
   pLoggingSession->done = 0;
   pLoggingSession->logType = 0;
-  ((WDI_DS_ClientDataType *)(pContext))->rxLogCB();
+  pLoggingSession->reasonCode = 0;
 
   return;
 }
diff --git a/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h b/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
index fc080e4..59a2024 100644
--- a/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
+++ b/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
@@ -446,6 +446,6 @@
 ---------------------------------------------------------------------------*/
 void wpalFwLogPktSerialize
 (
-   wpt_packet *pFrame
+   wpt_packet *pFrame, wpt_uint32 pktType
 );
 #endif // __WLAN_QCT_PAL_PACKET_H
diff --git a/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c b/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
index b35e550..cef17f9 100644
--- a/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
+++ b/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
@@ -1030,8 +1030,8 @@
 ---------------------------------------------------------------------------*/
 void wpalFwLogPktSerialize
 (
-   wpt_packet *pFrame
+   wpt_packet *pFrame, wpt_uint32 pktType
 )
 {
-    vos_logger_pkt_serialize(WPAL_TO_VOS_PKT(pFrame),LOG_PKT_TYPE_FW_LOG);
+    vos_logger_pkt_serialize(WPAL_TO_VOS_PKT(pFrame), pktType);
 }