[WCNCR00144638] dbdc: disable gmGetDequeueQuota() in usb/pcie mode

[Description]
Fix the timing calling qmGetDequeueQuota().
It is needed only in SDIO mode.

Change-Id: I72ef3316cfc7dbb7df35447338f92a14056110fb
Feature: dbdc
Signed-off-by: Chiahsuan Chuang <chiahsuan.chuang@mediatek.com>
CR-Id: WCNCR00144638
diff --git a/include/mgmt/rlm_domain.h b/include/mgmt/rlm_domain.h
index a43bd89..d5d2dc3 100644
--- a/include/mgmt/rlm_domain.h
+++ b/include/mgmt/rlm_domain.h
@@ -753,7 +753,7 @@
 void rlmDomainOidSetCountry(IN P_ADAPTER_T prAdapter, char *country, u8 size_of_country);
 u32 rlmDomainGetCountryCode(void);
 u32 rlmDomainGetTempCountryCode(void);
-void rlmDomianAssert(BOOLEAN cond);
+void rlmDomainAssert(BOOLEAN cond);
 
 /*******************************************************************************
 *                              F U N C T I O N S
diff --git a/include/nic/hal.h b/include/nic/hal.h
index c041a57..7d529d1 100644
--- a/include/nic/hal.h
+++ b/include/nic/hal.h
@@ -1049,4 +1049,5 @@
 WLAN_STATUS halReleaseIOBuffer(IN P_ADAPTER_T prAdapter);
 VOID halDeAggRxPktWorker(struct work_struct *work);
 VOID halPrintHifDbgInfo(IN P_ADAPTER_T prAdapter);
+BOOLEAN halIsTxResourceControlEn(IN P_ADAPTER_T prAdapter);
 #endif /* _HAL_H */
diff --git a/include/nic/que_mgt.h b/include/nic/que_mgt.h
index e4232b8..7ba0937 100644
--- a/include/nic/que_mgt.h
+++ b/include/nic/que_mgt.h
@@ -439,6 +439,7 @@
 	UINT_32 u4MaxForwardBufferCount;
 
 	OS_SYSTIME rLastTxPktDumpTime;
+	BOOLEAN fgIsTxResrouceControlEn;
 } QUE_MGT_T, *P_QUE_MGT_T;
 
 typedef struct _EVENT_RX_ADDBA_T {
@@ -758,7 +759,7 @@
 /* Queue Management and STA_REC Initialization                                */
 /*----------------------------------------------------------------------------*/
 
-VOID qmInit(IN P_ADAPTER_T prAdapter);
+VOID qmInit(IN P_ADAPTER_T prAdapter, IN BOOLEAN isTxResrouceControlEn);
 
 #if QM_TEST_MODE
 VOID qmTestCases(IN P_ADAPTER_T prAdapter);
diff --git a/mgmt/rlm_domain.c b/mgmt/rlm_domain.c
index aa4003b..325b104 100644
--- a/mgmt/rlm_domain.c
+++ b/mgmt/rlm_domain.c
@@ -2660,7 +2660,7 @@
 #endif
 }
 
-void rlmDomianAssert(BOOLEAN cond)
+void rlmDomainAssert(BOOLEAN cond)
 {
 	/* bypass this check because single sku is not enable */
 	if (!regd_is_single_sku_en())
diff --git a/nic/nic_tx.c b/nic/nic_tx.c
index 709c441..ff06a49 100644
--- a/nic/nic_tx.c
+++ b/nic/nic_tx.c
@@ -227,7 +227,7 @@
 	/* enable/disable TX resource control */
 	prTxCtrl->fgIsTxResourceCtrl = NIC_TX_RESOURCE_CTRL;
 
-	qmInit(prAdapter);
+	qmInit(prAdapter, halIsTxResourceControlEn(prAdapter));
 
 	TX_RESET_ALL_CNTS(prTxCtrl);
 
diff --git a/nic/que_mgt.c b/nic/que_mgt.c
index 75444f0..f24e225 100644
--- a/nic/que_mgt.c
+++ b/nic/que_mgt.c
@@ -230,7 +230,7 @@
 * \return (none)
 */
 /*----------------------------------------------------------------------------*/
-VOID qmInit(IN P_ADAPTER_T prAdapter)
+VOID qmInit(IN P_ADAPTER_T prAdapter, IN BOOLEAN isTxResrouceControlEn)
 {
 	UINT_32 u4Idx;
 #if QM_ADAPTIVE_TC_RESOURCE_CTRL
@@ -273,6 +273,8 @@
 
 	kalMemSet(&g_arMissTimeout, 0, sizeof(g_arMissTimeout));
 
+	prQM->fgIsTxResrouceControlEn = isTxResrouceControlEn;
+
 #if QM_ADAPTIVE_TC_RESOURCE_CTRL
 	/* 4 <4> Initialize TC resource control variables */
 	for (u4Idx = 0; u4Idx < TC_NUM; u4Idx++)
@@ -1294,10 +1296,12 @@
 				if (u4MaxForwardFrameCountLimit > prBssInfo->ucBssFreeQuota)
 					u4MaxForwardFrameCountLimit = prBssInfo->ucBssFreeQuota;
 			}
+
 #if CFG_SUPPORT_DBDC
-			if (prAdapter->rWifiVar.uDeQuePercentEnable && prAdapter->rWifiVar.fgDbDcModeEn)
+			if (prAdapter->rWifiVar.fgDbDcModeEn)
 				u4MaxResourceLimit = gmGetDequeueQuota(prAdapter, prStaRec, prBssInfo, u4TotalQuota);
 #endif
+
 			/* 4 <2.3> Dequeue packet */
 			/* Three cases to break: (1) No resource (2) No packets (3) Fairness */
 			while (!QUEUE_IS_EMPTY(prCurrQueue)) {
@@ -2148,6 +2152,12 @@
 	UINT_32	u4Weight = 100;
 	UINT_32	u4Quota;
 
+	P_QUE_MGT_T prQM = &prAdapter->rQM;
+
+	if ((prAdapter->rWifiVar.uDeQuePercentEnable == FALSE) ||
+		(prQM->fgIsTxResrouceControlEn == FALSE))
+		return u4TotalQuota;
+
 	if (prStaRec->ucDesiredPhyTypeSet & PHY_TYPE_BIT_VHT) {
 		if (prBssInfo->ucVhtChannelWidth > VHT_OP_CHANNEL_WIDTH_20_40) {
 			/* BW80 NSS1 rate: MCS9 433 Mbps */
diff --git a/os/linux/gl_cfg80211.c b/os/linux/gl_cfg80211.c
index 840ae8a..80d913a 100644
--- a/os/linux/gl_cfg80211.c
+++ b/os/linux/gl_cfg80211.c
@@ -3263,7 +3263,7 @@
 	} else if (rlmDomainIsCtrlStateEqualTo(REGD_STATE_INVALID)) {
 		DBGLOG(RLM, ERROR, "\n%s():\n---> WARNING. Transit to invalid state.\n", __func__);
 		DBGLOG(RLM, ERROR, "---> WARNING.\n ");
-		rlmDomianAssert(0);
+		rlmDomainAssert(0);
 #if 0
 		return; /*error state*/
 #endif
@@ -3311,7 +3311,7 @@
 			DBGLOG(RLM, ERROR, "%s(): Error, Cannot find the correct RegDomain. country = %s\n",
 				__func__, rlmDomainGetCountryCode());
 
-			rlmDomianAssert(0);
+			rlmDomainAssert(0);
 			return;
 		}
 
diff --git a/os/linux/hif/pcie/hal_api.c b/os/linux/hif/pcie/hal_api.c
index 5b593c2..7fc06a3 100644
--- a/os/linux/hif/pcie/hal_api.c
+++ b/os/linux/hif/pcie/hal_api.c
@@ -1679,3 +1679,7 @@
 
 }
 
+BOOLEAN halIsTxResourceControlEn(IN P_ADAPTER_T prAdapter)
+{
+	return FALSE;
+}
diff --git a/os/linux/hif/sdio/hal_api.c b/os/linux/hif/sdio/hal_api.c
index 94ccafd..d5967a2 100644
--- a/os/linux/hif/sdio/hal_api.c
+++ b/os/linux/hif/sdio/hal_api.c
@@ -2100,3 +2100,8 @@
 	halPollDbgCr(prAdapter, LP_OWN_BACK_FAILED_DBGCR_POLL_ROUND);
 }
 
+BOOLEAN halIsTxResourceControlEn(IN P_ADAPTER_T prAdapter)
+{
+	return TRUE;
+}
+
diff --git a/os/linux/hif/usb/hal_api.c b/os/linux/hif/usb/hal_api.c
index 9901744..1eff320 100644
--- a/os/linux/hif/usb/hal_api.c
+++ b/os/linux/hif/usb/hal_api.c
@@ -1433,3 +1433,8 @@
 
 }
 
+BOOLEAN halIsTxResourceControlEn(IN P_ADAPTER_T prAdapter)
+{
+	return FALSE;
+}
+