[WCNCR00174200] wifi: sync wifi driver to MP2_20180418150058

[Description]
Change wifi driver to MP2_20180418150058

Change-Id: I8048678e7940ecd2aba0c253967dc5930cfebe97
Signed-off-by: Jiehang Zheng <jiehang.zheng@mediatek.com>
CR-Id: WCNCR00174200
Feature: wifi
Reviewed-on: http://gerrit.mediatek.inc:8080/1481333
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: kun.wu <kun.wu@mediatek.com>
diff --git a/Makefile.ce b/Makefile.ce
index a40db5c..7c66a86 100644
--- a/Makefile.ce
+++ b/Makefile.ce
@@ -173,11 +173,18 @@
 
 CFG_CHIP_RESET_SUPPORT=0
 
+# 1: Enable SDIO RX Tasklet De-Aggregation
+# 0: Disable (default)
+CFG_SDIO_RX_AGG_TASKLET=0
+
 #/***** Platform dependent part ******/
 ifeq ($(PLATFORM),MT53XX)
+CFG_DRIVER_INITIAL_RUNNING_MODE=0
+CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0
 endif
 
 
+
 #/***** Manage configs into compile options ******/
 ifneq ($(CFG_NUM_DIFFERENT_CHANNELS_STA),)
 PLATFORM_FLAGS += -DCFG_NUM_DIFFERENT_CHANNELS_STA=$(CFG_NUM_DIFFERENT_CHANNELS_STA)
@@ -255,6 +262,9 @@
 PLATFORM_FLAGS += -DCFG_CHIP_RESET_SUPPORT=$(CFG_CHIP_RESET_SUPPORT)
 endif
 
+ifneq ($(CFG_SDIO_RX_AGG_TASKLET),)
+PLATFORM_FLAGS += -DCFG_SDIO_RX_AGG_TASKLET=$(CFG_SDIO_RX_AGG_TASKLET)
+endif
 ##############################################################
 # Compile settings
 ##############################################################
diff --git a/common/wlan_lib.c b/common/wlan_lib.c
index 94b0572..4bd1e6a 100644
--- a/common/wlan_lib.c
+++ b/common/wlan_lib.c
@@ -6748,6 +6748,9 @@
 	prWifiVar->ucAp2gBandwidth = (UINT_8) wlanCfgGetUint32(prAdapter, "Ap2gBw", MAX_BW_40MHZ);
 	prWifiVar->ucAp5gBandwidth = (UINT_8) wlanCfgGetUint32(prAdapter, "Ap5gBw", MAX_BW_80MHZ);
 	prWifiVar->ucApChnlDefFromCfg = (UINT_8) wlanCfgGetUint32(prAdapter, "ApChnlDefFromCfg", FEATURE_ENABLED);
+	prWifiVar->ucApAllowHtVhtTkip =
+		(UINT_8) wlanCfgGetUint32(prAdapter,
+			"ApAllowHtVhtTkip", FEATURE_DISABLED);
 
 	prWifiVar->ucNSS = (UINT_8) wlanCfgGetUint32(prAdapter, "Nss", 2);
 
@@ -9755,7 +9758,7 @@
 	}
 
 	/* After resuming, WinStart will unsync with AP's SN.
-	  * Set fgFirstSnToWinStart for all valid BA entry before suspend.
+	 * Set fgFirstSnToWinStart for all valid BA entry before suspend.
 	 */
 	for (idx = 0; idx < CFG_STA_REC_NUM; idx++) {
 		prStaRec = cnmGetStaRecByIndex(prGlueInfo->prAdapter, idx);
@@ -9770,7 +9773,6 @@
 			prRxBaEntry->fgFirstSnToWinStart = TRUE;
 		}
 	}
-
 }
 
 /*----------------------------------------------------------------------------*/
diff --git a/include/nic/adapter.h b/include/nic/adapter.h
index 5926010..fee93f1 100644
--- a/include/nic/adapter.h
+++ b/include/nic/adapter.h
@@ -737,6 +737,14 @@
 	/* Otherwise align cfg80211 */
 	UINT_8 ucApChnlDefFromCfg;
 
+	/*
+	 * According TGn/TGac 4.2.44, AP should not connect
+	 * to TKIP client with * HT/VHT capabilities. We leave
+	 * a wifi.cfg item for user to decide whether * to
+	 * enable HT/VHT capabilities in that case
+	 */
+	UINT_8 ucApAllowHtVhtTkip;
+
 	UINT_8 ucNSS;
 
 	UINT_8 ucRxMaxMpduLen;
diff --git a/mgmt/assoc.c b/mgmt/assoc.c
index 6a09336..8600cf2 100644
--- a/mgmt/assoc.c
+++ b/mgmt/assoc.c
@@ -1130,6 +1130,7 @@
 	P_RSN_INFO_ELEM_T prIeRsn = (P_RSN_INFO_ELEM_T) NULL;
 	P_IE_SUPPORTED_RATE_T prIeSupportedRate = (P_IE_SUPPORTED_RATE_T) NULL;
 	P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate = (P_IE_EXT_SUPPORTED_RATE_T) NULL;
+	P_WIFI_VAR_T prWifiVar = NULL;
 	PUINT_8 pucIE, pucIEStart;
 	UINT_16 u2IELength;
 	UINT_16 u2Offset = 0;
@@ -1138,7 +1139,7 @@
 	UINT_16 u2BSSBasicRateSet;
 	UINT_8 ucFixedFieldLength;
 	BOOLEAN fgIsUnknownBssBasicRate;
-	BOOLEAN fgIsHT = FALSE, fgIsTKIP = FALSE;
+	BOOLEAN fgIsTKIP = FALSE;
 	UINT_32 i;
 
 	if (!prAdapter || !prSwRfb || !pu2StatusCode) {
@@ -1146,6 +1147,8 @@
 		return WLAN_STATUS_FAILURE;
 	}
 
+	prWifiVar = &(prAdapter->rWifiVar);
+
 	prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
 
 	if (prStaRec == NULL)
@@ -1232,7 +1235,6 @@
 			break;
 		case ELEM_ID_HT_CAP:
 			prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_HT;
-			fgIsHT = TRUE;
 			break;
 		case ELEM_ID_VHT_CAP:
 			prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_VHT;
@@ -1295,6 +1297,13 @@
 		}
 	}			/* end of IE_FOR_EACH */
 
+	/*
+	 * According to TGn & TGac 4.2.44, AP should not bring HT/VHT Cap IE in
+	 * the IE of Assoc resp, if the STA request to use TKIP cipher
+	 */
+	if (fgIsTKIP && !prWifiVar->ucApAllowHtVhtTkip)
+		prStaRec->ucPhyTypeSet &= ~(PHY_TYPE_BIT_VHT | PHY_TYPE_BIT_HT);
+
 	/* parsing for WMM related information (2010/12/21) */
 	mqmProcessAssocReq(prAdapter, prSwRfb, pucIEStart, u2IELength);
 
@@ -1399,9 +1408,6 @@
 	}
 #endif
 
-	if (fgIsHT && fgIsTKIP && prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)
-		u2StatusCode = STATUS_CODE_REQ_DECLINED;
-
 	*pu2StatusCode = u2StatusCode;
 
 	return WLAN_STATUS_SUCCESS;
diff --git a/nic/que_mgt.c b/nic/que_mgt.c
index 219a630..45392d3 100644
--- a/nic/que_mgt.c
+++ b/nic/que_mgt.c
@@ -2679,22 +2679,21 @@
 #endif
 
 	RX_DIRECT_REORDER_LOCK(prAdapter, 0);
-
 	/* After resuming, WinStart and WinEnd are obsolete and unsync
 	 * with AP's SN. So assign the SN of first packet to WinStart
 	 * as "Fall Within" case.
 	 */
 	if (prReorderQueParm->fgFirstSnToWinStart) {
 		DBGLOG(QM, INFO,
-			"[%u] First resumed SN(%u) reset Window{%u,%u}\n",
-			prSwRfb->ucTid, prSwRfb->u2SSN,
-			prReorderQueParm->u2WinStart,
-			prReorderQueParm->u2WinEnd);
+		       "[%u] First resumed SN(%u) reset Window{%u,%u}\n",
+		       prSwRfb->ucTid, prSwRfb->u2SSN,
+		       prReorderQueParm->u2WinStart,
+		       prReorderQueParm->u2WinEnd);
 
 		prReorderQueParm->u2WinStart = prSwRfb->u2SSN;
 		prReorderQueParm->u2WinEnd =
-			((prReorderQueParm->u2WinStart) +
-			(prReorderQueParm->u2WinSize) - 1) % MAX_SEQ_NO_COUNT;
+		    ((prReorderQueParm->u2WinStart) +
+		     (prReorderQueParm->u2WinSize) - 1) % MAX_SEQ_NO_COUNT;
 		prReorderQueParm->fgFirstSnToWinStart = FALSE;
 	}
 
@@ -4289,9 +4288,9 @@
 
 					prStaRec->fgIsWmmSupported = TRUE;
 					prStaRec->fgIsUapsdSupported =
-				(((((P_IE_WMM_PARAM_T) pucIE)->ucQosInfo)
-				& WMM_QOS_INFO_UAPSD) ?
-				TRUE : FALSE);
+					(((((P_IE_WMM_PARAM_T)pucIE)->ucQosInfo)
+					& WMM_QOS_INFO_UAPSD) ?
+					TRUE : FALSE);
 					break;
 
 				case VENDOR_OUI_SUBTYPE_WMM_INFO:
@@ -4301,7 +4300,7 @@
 					prStaRec->fgIsWmmSupported = TRUE;
 					prStaRec->fgIsUapsdSupported =
 					(((((P_IE_WMM_INFO_T) pucIE)->ucQosInfo)
-						& WMM_QOS_INFO_UAPSD) ?
+					& WMM_QOS_INFO_UAPSD) ?
 						     TRUE : FALSE);
 					break;