[WCNCR00164404] cert: Fix TGn-4.2.25 softap forwarding fail in USB
[Description]
Fix TGn-4.2.25 softap forwarding fail in USB.
Root cause: PP will stop sending MSDU_ID packet to CR4 when host stops
receiving Rx data packets. That causes a dead lock.
Solution:
- Enlarge SW RFB size.
- Driver discard USB Rx packets when out-of-SW-RFB situation continues
Change-Id: I5e31f31daea279d74e6951a2c38bd2c66f134ceb
Signed-off-by: Desmond Lin <desmond.lin@mediatek.com>
CR-Id: WCNCR00164404
Feature: cert
diff --git a/os/linux/hif/usb/hal_api.c b/os/linux/hif/usb/hal_api.c
index fe4e53d..ae8a51b 100644
--- a/os/linux/hif/usb/hal_api.c
+++ b/os/linux/hif/usb/hal_api.c
@@ -968,6 +968,7 @@
UINT_32 u4BufLen;
static BOOL s_fgOutOfSwRfb = FALSE;
static UINT_32 s_u4OutOfSwRfbPrintLimit;
+ static UINT_32 s_u4OutOfSwRfbBeginTime;
/* Process complete event/data */
prUsbReq = glUsbDequeueReq(prHifInfo, prCompleteQ, &prHifInfo->rRxEventQLock);
@@ -997,8 +998,22 @@
DBGLOG(RX, WARN, "Out of SwRfb!\n");
s_u4OutOfSwRfbPrintLimit = jiffies + MSEC_TO_JIFFIES(SW_RFB_LOG_LIMIT_MS);
}
+ s_u4OutOfSwRfbBeginTime = jiffies;
s_fgOutOfSwRfb = TRUE;
}
+
+ /* If the out-of-SW-RFB situation continues more than SW_RFB_BLOCKING_LIMIT_MS millie seconds,
+ * we discard the remaining Rx packets so as to break the possible dead lock
+ */
+ if (jiffies_to_msecs((long)jiffies - (long)s_u4OutOfSwRfbBeginTime) >
+ SW_RFB_BLOCKING_LIMIT_MS) {
+ DBGLOG(RX, WARN, "Discard Rx packets (%u bytes)!\n",
+ prUrb->actual_length - prBufCtrl->u4ReadSize);
+ glUsbEnqueueReq(prHifInfo, prFreeQ, prUsbReq, &prHifInfo->rRxEventQLock, FALSE);
+ s_fgOutOfSwRfb = FALSE;
+ break;
+ }
+
glUsbEnqueueReq(prHifInfo, prCompleteQ, prUsbReq, &prHifInfo->rRxEventQLock, TRUE);
set_bit(GLUE_FLAG_RX_BIT, &prGlueInfo->ulFlag);
diff --git a/os/linux/hif/usb/include/hif.h b/os/linux/hif/usb/include/hif.h
index 476aa2f..b415885 100644
--- a/os/linux/hif/usb/include/hif.h
+++ b/os/linux/hif/usb/include/hif.h
@@ -97,7 +97,7 @@
#define HIF_IST_LOOP_COUNT (4)
#define HIF_IST_TX_THRESHOLD (1) /* Min msdu count to trigger Tx during INT polling state */
-#define HIF_NUM_OF_QM_RX_PKT_NUM (512)
+#define HIF_NUM_OF_QM_RX_PKT_NUM (1024)
#define HIF_TX_BUFF_COUNT_TC0 256
#define HIF_TX_BUFF_COUNT_TC1 256
@@ -178,6 +178,7 @@
#define INTERRUPT_TIMEOUT_MS (1000)
#define SW_RFB_RECHECK_MS (10)
#define SW_RFB_LOG_LIMIT_MS (5000)
+#define SW_RFB_BLOCKING_LIMIT_MS (1000)
/* Vendor Request */
#define VND_REQ_POWER_ON_WIFI (0x4)