[WCNCR00146539] cert: Add power cap ie in assoc/reassoc req
[Description]
Add power cap ie in assoc/reassoc req
After set CFG_SUPPORT_SPEC_MGMT to 1, wlan will set spectrum management bit
to 1 in Capability field and bring power capability IE in assoc/reassoc
request frames. Thus, we can successfully connect to testbed APs in
TGn 5.2.22 & 5.2.32 without changing CFG_SUPPORT_SPEC_MGMT macro
correspondingly.
Change-Id: I3977691df6e6efe31fec57cecc79adc80aef475c
CR-Id: WCNCR00146539
Feature: cert
Signed-off-by: Awk Jiang <awk.jiang@mediatek.com>
diff --git a/include/config.h b/include/config.h
index 0909cef..86fb9b4 100644
--- a/include/config.h
+++ b/include/config.h
@@ -160,7 +160,7 @@
#if (CFG_SUPPORT_DFS == 1) /* Add by Enlai */
#define CFG_SUPPORT_QUIET 0 /* Quiet (802.11h) */
-#define CFG_SUPPORT_SPEC_MGMT 0 /* Spectrum Management (802.11h): TPC and DFS */
+#define CFG_SUPPORT_SPEC_MGMT 1 /* Spectrum Management (802.11h): TPC and DFS */
#else
#define CFG_SUPPORT_QUIET 0 /* Quiet (802.11h) */
#define CFG_SUPPORT_SPEC_MGMT 0 /* Spectrum Management (802.11h): TPC and DFS */
diff --git a/include/mgmt/rlm.h b/include/mgmt/rlm.h
index 5312963..2e12a33 100644
--- a/include/mgmt/rlm.h
+++ b/include/mgmt/rlm.h
@@ -273,6 +273,8 @@
VOID rlmFsmEventUninit(P_ADAPTER_T prAdapter);
+VOID rlmReqGeneratePowerCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
+
VOID rlmReqGenerateHtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmReqGenerateExtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
diff --git a/include/nic/mac.h b/include/nic/mac.h
index 4891f5f..5284db2 100644
--- a/include/nic/mac.h
+++ b/include/nic/mac.h
@@ -878,6 +878,9 @@
/* 7.3.2.14 Extended Supported Rates */
#define ELEM_MAX_LEN_EXTENDED_SUP_RATES 255
+/* 7.3.2.16 Power Capability element */
+#define ELEM_MAX_LEN_POWER_CAP 2
+
/* 7.3.2.21 Measurement Request element */
#define ELEM_RM_TYPE_BASIC_REQ 0
#define ELEM_RM_TYPE_CCA_REQ 1
@@ -2602,6 +2605,8 @@
#define EXT_CAP_IE(fp) ((P_EXT_CAP_T) fp)
+#define POWER_CAP_IE(fp) ((P_IE_POWER_CAP_T) fp)
+
#define HT_CAP_IE(fp) ((P_IE_HT_CAP_T) fp)
#define HT_OP_IE(fp) ((P_IE_HT_OP_T) fp)
diff --git a/mgmt/assoc.c b/mgmt/assoc.c
index 72f3677..9c06be3 100644
--- a/mgmt/assoc.c
+++ b/mgmt/assoc.c
@@ -85,6 +85,10 @@
********************************************************************************
*/
APPEND_VAR_IE_ENTRY_T txAssocReqIETable[] = {
+#if CFG_SUPPORT_SPEC_MGMT
+ {(ELEM_HDR_LEN + ELEM_MAX_LEN_POWER_CAP), NULL, rlmReqGeneratePowerCapIE}
+ , /* 33 */
+#endif
{(ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmReqGenerateHtCapIE}
, /* 45 */
#if CFG_SUPPORT_WPS2
@@ -202,9 +206,12 @@
{
UINT_32 u4NonHTPhyType;
UINT_16 u2CapInfo;
+ P_BSS_INFO_T prBssInfo;
ASSERT(prStaRec);
+ prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prStaRec->ucBssIndex);
+
/* Set up our requested capabilities. */
u2CapInfo = CAP_INFO_ESS;
u2CapInfo |= CAP_CF_STA_NOT_POLLABLE;
@@ -230,7 +237,12 @@
}
#if CFG_SUPPORT_SPEC_MGMT
- if (prAdapter->fgEnable5GBand == TRUE)
+ /* 802.11h spectrum management is for 5G band, so
+ * now we only enable spectrum management bit for 5G case.
+ * In TGn 5.2.22, spectrum management bit should set to 1
+ * to pass the UCC's check.
+ */
+ if (prBssInfo && prBssInfo->eBand == BAND_5G)
u2CapInfo |= CAP_INFO_SPEC_MGT;
#endif
diff --git a/mgmt/rlm.c b/mgmt/rlm.c
index 790e8c6..ea8159a 100644
--- a/mgmt/rlm.c
+++ b/mgmt/rlm.c
@@ -199,6 +199,44 @@
/*----------------------------------------------------------------------------*/
/*!
+* \brief For association request, power capability
+*
+* \param[in]
+*
+* \return none
+*/
+/*----------------------------------------------------------------------------*/
+VOID rlmReqGeneratePowerCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo)
+{
+ PUINT_8 pucBuffer;
+ P_BSS_INFO_T prBssInfo;
+
+ ASSERT(prAdapter);
+ ASSERT(prMsduInfo);
+
+ prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prMsduInfo->ucBssIndex);
+
+ /* We should add power capability IE in assoc/reassoc req if the spectrum
+ * management bit is set to 1 in Capability Infor field, or the connection
+ * will be rejected by Marvell APs in some TGn items. (e.g. 5.2.32).
+ * Spectrum management related feature (802.11h) is for 5G band.
+ */
+ if (!prBssInfo || prBssInfo->eBand != BAND_5G)
+ return;
+
+ pucBuffer = (PUINT_8) ((ULONG) prMsduInfo->prPacket + (ULONG) prMsduInfo->u2FrameLength);
+
+ POWER_CAP_IE(pucBuffer)->ucId = ELEM_ID_PWR_CAP;
+ POWER_CAP_IE(pucBuffer)->ucLength = ELEM_MAX_LEN_POWER_CAP;
+ POWER_CAP_IE(pucBuffer)->cMinTxPowerCap = 15;
+ POWER_CAP_IE(pucBuffer)->cMaxTxPowerCap = 20;
+
+ prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer);
+ pucBuffer += IE_SIZE(pucBuffer);
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
* \brief For probe request, association request
*
* \param[in]