prima: change in host and fw interface for enchanced txBd.

FW sends the status and txBdToken as part of the tx bd completion
indication with enhanced tx bd completion feature.

txBdToken is a 32 bit unsigned integer generated by PE to track
per packet ack confirmation from FW. PE passes this token to FW
if it has registered the callback to get the ack confirmation.
FW sends this token back to host when sending the ack status
to host. By using the combination of ack status and token host
knows whether a particular frame has been transmitted over the
air successfully or not.

In the current implementation P2P, TDLS and few mgmt frames are
requesting for txBd completion from the firmware.

This gerrit has changes to handle the token for above mentioned
action frames. It also has the changes for Host and FW interaface.

Change-Id: Id34b7eb114fa772b8c5dbd32a600e3896216f6ff
CRs-Fixed: 812924
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index cb6959c..eb4c82d 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -5723,4 +5723,10 @@
     tANI_U32 event_data_len;
     tANI_U8  event_data[1];
 } tSirNanEvent, *tpSirNanEvent;
+
+typedef struct
+{
+    tANI_U32 txCompleteStatus;
+    tANI_U32 txBdToken;
+}tSirTxBdStatus, *tpSirTxBdStatus;
 #endif /* __SIR_API_H */
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index 0c0ea66..35074ef 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -128,6 +128,7 @@
    TDLS_OFF_CHANNEL      = 51,
 #endif
    MGMT_FRAME_LOGGING    = 53,
+   ENHANCED_TXBD_COMPLETION = 54,
    //MAX_FEATURE_SUPPORTED = 128
 } placeHolderInCapBitmap;
 
diff --git a/CORE/MAC/src/pe/lim/limP2P.c b/CORE/MAC/src/pe/lim/limP2P.c
index 3c51e00..bea1899 100644
--- a/CORE/MAC/src/pe/lim/limP2P.c
+++ b/CORE/MAC/src/pe/lim/limP2P.c
@@ -671,6 +671,8 @@
     tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
     tSirMacAddr             nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
     tANI_U32 txStatus = 0;
+    tSirTxBdStatus txBdStatus = {0};
+
     if ( NULL == MsgRemainonChannel )
     {
         PELOGE(limLog( pMac, LOGP,
@@ -722,9 +724,13 @@
      * indicaiton confirmation with status failure */
     if (pMac->lim.mgmtFrameSessionId != 0xff)
     {
-       limLog(pMac, LOGE,
-              FL("Remain on channel expired, Action frame status failure"));
-       limP2PActionCnf(pMac, &txStatus);
+        limLog(pMac, LOGE,
+                FL("Remain on channel expired, Action frame status failure"));
+
+        if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+            limP2PActionCnf(pMac, &txBdStatus);
+        else
+            limP2PActionCnf(pMac, &txStatus);
     }
 
     return;
@@ -839,6 +845,7 @@
 eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, void *pData)
 {
     tANI_U32 txCompleteSuccess;
+    tpSirTxBdStatus pTxBdStatus;
 
     if (!pData)
     {
@@ -847,11 +854,25 @@
         return eHAL_STATUS_FAILURE;
     }
 
-    txCompleteSuccess = *((tANI_U32*) pData);
+    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+    {
+        pTxBdStatus = (tpSirTxBdStatus) pData;
+        txCompleteSuccess = pTxBdStatus->txCompleteStatus;
 
-    limLog(pMac, LOG1,
-              FL(" %s txCompleteSuccess %d, Session Id %d"),
-              __func__, txCompleteSuccess, pMac->lim.mgmtFrameSessionId);
+        limLog(pMac, LOG1,
+                FL("txCompleteSuccess %d, Token %u, Session Id %d"),
+                txCompleteSuccess, pTxBdStatus->txBdToken,
+                pMac->lim.mgmtFrameSessionId);
+    }
+    else
+    {
+        txCompleteSuccess = *((tANI_U32*) pData);
+
+        limLog(pMac, LOG1,
+                FL(" %s txCompleteSuccess %d, Session Id %d"),
+                __func__, txCompleteSuccess, pMac->lim.mgmtFrameSessionId);
+    }
+
     if (pMac->lim.mgmtFrameSessionId != 0xff)
     {
         /* The session entry might be invalid(0xff) action confirmation received after
diff --git a/CORE/MAC/src/pe/lim/limProcessTdls.c b/CORE/MAC/src/pe/lim/limProcessTdls.c
index bbf1573..b486788 100644
--- a/CORE/MAC/src/pe/lim/limProcessTdls.c
+++ b/CORE/MAC/src/pe/lim/limProcessTdls.c
@@ -546,6 +546,7 @@
 {
     tpPESession psessionEntry = NULL ;
     tANI_U32 txCompleteSuccess = 0;
+    tpSirTxBdStatus pTxBdStatus = NULL;
 
     if (!pData)
     {
@@ -553,7 +554,18 @@
         return eHAL_STATUS_SUCCESS;
     }
 
-    txCompleteSuccess = *((tANI_U32*) pData);
+    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+    {
+        pTxBdStatus = (tpSirTxBdStatus) pData;
+        txCompleteSuccess = pTxBdStatus->txCompleteStatus;
+        limLog(pMac, LOG1, FL("txCompleteSuccess %u, token %u"),
+                txCompleteSuccess, pTxBdStatus->txBdToken);
+    }
+    else
+    {
+        txCompleteSuccess = *((tANI_U32*) pData);
+        limLog(pMac, LOG1, FL("txCompleteSuccess %u"), txCompleteSuccess);
+    }
 
     if (0xff != pMac->lim.mgmtFrameSessionId)
     {
diff --git a/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
index 7e6a832..a8e65e6 100644
--- a/CORE/MAC/src/pe/lim/limSendManagementFrames.c
+++ b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -4077,11 +4077,25 @@
 
 eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
 {
+    if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+    {
+        tpSirTxBdStatus pTxBdStatus;
+        pTxBdStatus = (tpSirTxBdStatus) pData;
+        limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
+                pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
+    }
     return limSendDisassocCnf(pMac);
 }
 
 eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
 {
+    if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+    {
+        tpSirTxBdStatus pTxBdStatus;
+        pTxBdStatus = (tpSirTxBdStatus) pData;
+        limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
+                pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
+    }
     return limSendDeauthCnf(pMac);
 }
 
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 621909e..edfca0a 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -14337,8 +14337,11 @@
             {  
                VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                   "Tx Complete timeout Timer Stop Failed ");
-            }  
-            pWDA->pAckTxCbFunc( pMac, &wdiLowLevelInd->wdiIndicationData.tx_complete_status);
+            }
+            if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
+                pWDA->pAckTxCbFunc( pMac, &wdiLowLevelInd->wdiIndicationData.tx_complete_status);
+            else
+                pWDA->pAckTxCbFunc( pMac, &wdiLowLevelInd->wdiIndicationData.wdiTxBdInd);
             pWDA->pAckTxCbFunc = NULL;
          }
          else
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
index beb2016..f0b03f3 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -876,6 +876,11 @@
     wpt_macAddr  bssId;   // TO SUPPORT BT-AMP
 }  WDI_DeleteBAIndType;
 
+typedef struct
+{
+    wpt_uint32 tx_complete_status;
+    wpt_uint32 tx_bd_token;
+}  WDI_TxBDStatus;
 /*---------------------------------------------------------------------------
   WDI_LowLevelIndType
     Inidcation type and information about the indication being carried
@@ -956,6 +961,8 @@
     WDI_DeleteBAIndType         wdiDeleteBAInd;
 
     WDI_NanEventType wdiNanEvent;
+
+    WDI_TxBDStatus              wdiTxBdInd;
   }  wdiIndicationData;
 }WDI_LowLevelIndType;
 
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index badb431..0fa54e7 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -202,6 +202,7 @@
 #endif
    ,FEATURE_NOT_SUPPORTED          //52
    ,MGMT_FRAME_LOGGING             //53
+   ,ENHANCED_TXBD_COMPLETION       //54
 };
 
 /*-------------------------------------------------------------------------- 
diff --git a/riva/inc/wlan_hal_msg.h b/riva/inc/wlan_hal_msg.h
index 5140db2..452ad61 100644
--- a/riva/inc/wlan_hal_msg.h
+++ b/riva/inc/wlan_hal_msg.h
@@ -5768,6 +5768,8 @@
 {
    /*Tx Complete Indication Success or Failure*/
    tANI_U32   status;
+   /* Dialog token */
+   tANI_U32   dialogToken;
 }tTxComplParams,*tpTxComplParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -6713,6 +6715,7 @@
     BCN_IE_FLT_DELTA       = 49,
     TDLS_OFF_CHANNEL       = 51,
     MGMT_FRAME_LOGGING     = 53,
+    ENHANCED_TXBD_COMPLETION = 54,
     MAX_FEATURE_SUPPORTED  = 128,
 } placeHolderInCapBitmap;
 
@@ -6740,6 +6743,7 @@
 #define IS_DYNAMIC_WMM_PS_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(DYNAMIC_WMM_PS))))
 #define IS_MAC_SPOOF_SCAN_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(MAC_SPOOFED_SCAN))))
 #define IS_NEW_BMU_ERROR_RECOVERY_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(BMU_ERROR_GENERIC_RECOVERY))))
+#define IS_ENHANCED_TXBD_COMPLETION_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(ENHANCED_TXBD_COMPLETION))))
 
 tANI_U8 halMsg_GetHostWlanFeatCaps(tANI_U8 feat_enum_value);