wlan: Avoid dropping packets if data packet filter is set

Currently, when MSDU reorder info exists for a tid of station, then
host last Rx packet sequence number SSN goes out of sync with the
hardware. As a result data packets other than the filtered packets
in firmware which arrive on a particular tid to host will get dropped.
In this change avoid dropping the packet if data packet filter is set.

Change-Id: I4128e3be118afd76fd4abacc45f6ceb0f865ba5e
CRs-Fixed: 1088971
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 5c161ba..e4249e3 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -9089,6 +9089,8 @@
                 return -EINVAL;
             }
 
+            WLANTL_SetDataPktFilter((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                    pHddStaCtx->conn_info.staId[0], true);
             break;
 
         case HDD_RCV_FILTER_CLEAR:
@@ -9126,6 +9128,9 @@
                                 status);
                return -EINVAL;
             }
+
+            WLANTL_SetDataPktFilter((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                    pHddStaCtx->conn_info.staId[0], false);
             break;
 
         default :
diff --git a/CORE/TL/inc/wlan_qct_tl.h b/CORE/TL/inc/wlan_qct_tl.h
index 9f200b5..9b80e04 100644
--- a/CORE/TL/inc/wlan_qct_tl.h
+++ b/CORE/TL/inc/wlan_qct_tl.h
@@ -3364,4 +3364,16 @@
  */
 void WLANTL_ResetRxSSN(v_PVOID_t pvosGCtx, uint8_t ucSTAId);
 
+/*
+ * WLANTL_SetDataPktFilter - Set data filter flag
+ * @pvosGCtx: global vos context
+ * @ucSTAId: station id
+ * @flag: packet data filter flag
+ *
+ * This function sets the data pkt filter flag of all tids
+ * of the station for whom BA reorder session exists.
+ *
+ * Return: none
+ */
+void WLANTL_SetDataPktFilter(v_PVOID_t pvosGCtx, uint8_t ucSTAId, bool flag);
 #endif /* #ifndef WLAN_QCT_WLANTL_H */
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 5ef562b..da81f27 100644
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -13816,6 +13816,37 @@
   }
 }
 
+void WLANTL_SetDataPktFilter(v_PVOID_t pvosGCtx, uint8_t ucSTAId, bool flag)
+{
+   WLANTL_CbType*  pTLCb = NULL;
+   WLANTL_STAClientType* pClientSTA = NULL;
+   uint8_t i;
+
+   if (WLANTL_STA_ID_INVALID(ucSTAId)) {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+            "%s: Invalid station id requested", __func__));
+      return;
+   }
+
+   pTLCb = VOS_GET_TL_CB(pvosGCtx);
+   if (NULL == pTLCb) {
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "%s: Invalid TL pointer from pvosGCtx", __func__));
+   return;
+   }
+
+   pClientSTA = pTLCb->atlSTAClients[ucSTAId];
+
+   for (i = 0; i < WLAN_MAX_TID ; i++) {
+      if (0 == pClientSTA->atlBAReorderInfo[i].ucExists)
+         continue;
+
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            "WLAN TL: Last RxSSN reset to zero for tid %d", i));
+      pClientSTA->atlBAReorderInfo[i].set_data_filter = flag;
+   }
+}
+
 #ifdef WLAN_FEATURE_RMC
 VOS_STATUS WLANTL_RmcInit
 (
diff --git a/CORE/TL/src/wlan_qct_tl_ba.c b/CORE/TL/src/wlan_qct_tl_ba.c
index 9f60188..f940585 100644
--- a/CORE/TL/src/wlan_qct_tl_ba.c
+++ b/CORE/TL/src/wlan_qct_tl_ba.c
@@ -1156,7 +1156,8 @@
          break;
 
       case WLANTL_OPCODE_QCUR_FWDBUF:
-         if (currentReorderInfo->LastSN > CSN)
+         if ((currentReorderInfo->LastSN > CSN) &&
+              !(currentReorderInfo->set_data_filter))
          {
              if ((currentReorderInfo->LastSN - CSN) < CSN_WRAP_AROUND_THRESHOLD)
              {
@@ -1299,7 +1300,8 @@
          break;
 
       case WLANTL_OPCODE_QCUR:
-        if (currentReorderInfo->LastSN > CSN)
+        if ((currentReorderInfo->LastSN > CSN) &&
+            !(currentReorderInfo->set_data_filter))
         {
             if ((currentReorderInfo->LastSN - CSN) < CSN_WRAP_AROUND_THRESHOLD)
             {
diff --git a/CORE/TL/src/wlan_qct_tli.h b/CORE/TL/src/wlan_qct_tli.h
index 5069863..4d23eb2 100644
--- a/CORE/TL/src/wlan_qct_tli.h
+++ b/CORE/TL/src/wlan_qct_tli.h
@@ -484,6 +484,7 @@
   WLANTL_REORDER_BUFFER_T     *reorderBuffer;
 
   v_U16_t            LastSN;
+  bool               set_data_filter;
 }WLANTL_BAReorderType;