[WCNCR00170394] perf: Change Rx reordering timeout

[Description]
Change Rx reordering timeout from 1s to 200 ms

Shorten Rx reordering timeout to mitigate TCP ACK pending issue
It might caused by Rx TCP data with some error especially in COEX mode

Change-Id: I32184dd603b749a51a6eae0db3fa55eb3d13cb36
Signed-off-by: mtk04775 <changyi.hsu@mediatek.com>
CR-Id: WCNCR00170394
Feature: perf
Reviewed-on: http://gerrit.mediatek.inc:8080/1282139
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: George Kuo <george.kuo@mediatek.com>
Reviewed-by: Ted Huang <ted.huang@mediatek.com>
Reviewed-by: Deren Wu <deren.wu@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
(cherry picked from commit 64e56772d12e314488b64b20bdd354fd42633cac)
Reviewed-on: http://gerrit.mediatek.inc:8080/1282681
diff --git a/include/nic/que_mgt.h b/include/nic/que_mgt.h
index ae134fc..8967dd1 100644
--- a/include/nic/que_mgt.h
+++ b/include/nic/que_mgt.h
@@ -221,7 +221,7 @@
 
 #define TXM_DEFAULT_FLUSH_QUEUE_GUARD_TIME              0	/* Unit: 64 us */
 
-#define QM_RX_BA_ENTRY_MISS_TIMEOUT_MS      (1000)
+#define QM_RX_BA_ENTRY_MISS_TIMEOUT_MS      (200)
 
 #if CFG_M0VE_BA_TO_DRIVER
 /* MQM internal control bitmap per-bit usage (for operations on g_prMqm->u4FlagBitmap) */
diff --git a/nic/que_mgt.c b/nic/que_mgt.c
index 795c20b..7a1af12 100644
--- a/nic/que_mgt.c
+++ b/nic/que_mgt.c
@@ -3003,7 +3003,7 @@
 	P_SW_RFB_T prReorderedSwRfb;
 	P_QUE_T prReorderQue;
 	BOOLEAN fgDequeuHead, fgMissing;
-	OS_SYSTIME rCurrentTime, rMissTimeout;
+	OS_SYSTIME rCurrentTime, *prMissTimeout;
 	P_HW_MAC_RX_DESC_T prRxStatus;
 	UINT_8 fgIsAmsduSubframe;/* RX reorder for one MSDU in AMSDU issue */
 
@@ -3011,8 +3011,8 @@
 
 	fgMissing = FALSE;
 	rCurrentTime = 0;
-	rMissTimeout = g_arMissTimeout[prReorderQueParm->ucStaRecIdx][prReorderQueParm->ucTid];
-	if (rMissTimeout) {
+	prMissTimeout = &g_arMissTimeout[prReorderQueParm->ucStaRecIdx][prReorderQueParm->ucTid];
+	if (*prMissTimeout) {
 		fgMissing = TRUE;
 		GET_CURRENT_SYSTIME(&rCurrentTime);
 	}
@@ -3070,7 +3070,7 @@
 					prReorderQueParm->u2WinEnd);
 			}
 
-			if (fgMissing && CHECK_FOR_TIMEOUT(rCurrentTime, rMissTimeout,
+			if (fgMissing && CHECK_FOR_TIMEOUT(rCurrentTime, *prMissTimeout,
 				MSEC_TO_SYSTIME(QM_RX_BA_ENTRY_MISS_TIMEOUT_MS))) {
 
 				DBGLOG(QM, TRACE, "QM:RX BA Timout Next Tid %d SSN %d\n", prReorderQueParm->ucTid,
@@ -3103,10 +3103,10 @@
 	}
 
 	if (QUEUE_IS_EMPTY(prReorderQue))
-		rMissTimeout = 0;
+		*prMissTimeout = 0;
 	else {
 		if (fgMissing == FALSE)
-			GET_CURRENT_SYSTIME(&rMissTimeout);
+			GET_CURRENT_SYSTIME(prMissTimeout);
 	}
 
 	/* After WinStart has been determined, update the WinEnd */
@@ -3287,6 +3287,7 @@
 	QUE_T rReturnedQue;
 	P_QUE_T prReturnedQue = &rReturnedQue;
 	P_SW_RFB_T prReorderedSwRfb, prSwRfb;
+	OS_SYSTIME *prMissTimeout;
 
 	prCheckReorderEvent = (P_EVENT_CHECK_REORDER_BUBBLE_T) (prEvent->aucBuffer);
 
@@ -3379,6 +3380,14 @@
 		       prReorderQueParm->u2FirstBubbleSn, prReorderQueParm->u2WinStart, prReorderQueParm->u2WinEnd);
 	}
 
+	prMissTimeout = &g_arMissTimeout[prReorderQueParm->ucStaRecIdx][prReorderQueParm->ucTid];
+	if (QUEUE_IS_EMPTY(prReorderQue)) {
+		DBGLOG(QM, TRACE, "QM:(Bub Check) Reset prMissTimeout to zero\n");
+		*prMissTimeout = 0;
+	} else {
+		DBGLOG(QM, TRACE, "QM:(Bub Check) Reset prMissTimeout to current time\n");
+		GET_CURRENT_SYSTIME(prMissTimeout);
+	}
 }
 
 BOOLEAN qmCompareSnIsLessThan(IN UINT_32 u4SnLess, IN UINT_32 u4SnGreater)