Browse Source

qcacld-3.0: Fix edca parameter issue

qcacld-2.0 to qcacld-3.0 propagation

Update EDCA parameter if the country is in European
Union based on new ETSI RED channel access parameters.

Change-Id: I08b1a0d7cd0ee1f6985cd0810c5c4c1108e582b4
CRs-Fixed: 2078985
Liangwei Dong 7 years ago
parent
commit
ffd52d1f27

+ 7 - 1
core/cds/inc/cds_regdomain.h

@@ -538,5 +538,11 @@ struct reg_dmn_tables {
 int32_t cds_fill_some_regulatory_info(struct regulatory *reg);
 int32_t cds_get_country_from_alpha2(uint8_t *alpha2);
 void cds_fill_and_send_ctl_to_fw(struct regulatory *reg);
-
+/**
+ * cds_is_etsi_europe_country - check ETSI Europe country or not
+ * @country: country string with two Characters
+ *
+ * Return: true if country in ETSI Europe country list
+ */
+bool cds_is_etsi_europe_country(uint8_t *country);
 #endif /* __CDS_REGDOMAIN_H */

+ 57 - 0
core/cds/src/cds_regdomain.c

@@ -378,6 +378,63 @@ struct reg_dmn_tables g_reg_dmn_tbl = {
 	QDF_ARRAY_SIZE(g_reg_dmns),
 };
 
+/*
+ *  ETSI is updating EN 301 893, which specifies 5 GHz channel access
+ *  in Europe
+ */
+static const char etsi_europe_country[][2] = {
+	{'A', 'T'},
+	{'B', 'E'},
+	{'B', 'G'},
+	{'C', 'Z'},
+	{'D', 'K'},
+	{'E', 'E'},
+	{'F', 'R'},
+
+	{'D', 'E'},
+	{'I', 'S'},
+	{'I', 'E'},
+	{'I', 'T'},
+	{'E', 'L'},
+	{'E', 'S'},
+	{'C', 'Y'},
+
+	{'L', 'V'},
+	{'L', 'I'},
+	{'L', 'T'},
+	{'L', 'U'},
+	{'H', 'U'},
+	{'M', 'T'},
+	{'N', 'L'},
+
+	{'N', 'O'},
+	{'P', 'L'},
+	{'P', 'T'},
+	{'R', 'O'},
+	{'S', 'I'},
+	{'S', 'K'},
+	{'T', 'R'},
+
+	{'F', 'I'},
+	{'S', 'E'},
+	{'C', 'H'},
+	{'U', 'K'},
+	{'H', 'R'},
+};
+
+bool cds_is_etsi_europe_country(uint8_t *country)
+{
+	int32_t i;
+
+	for (i = 0; i < QDF_ARRAY_SIZE(etsi_europe_country); i++) {
+		if (country[0] == etsi_europe_country[i][0] &&
+		    country[1] == etsi_europe_country[i][1])
+			return true;
+	}
+
+	return false;
+}
+
 /**
  * get_bdf_reg_dmn() - get regulatory domain from BDF
  * @reg_dmn: BDF regulatory domain

+ 18 - 1
core/mac/inc/wni_cfg.h

@@ -319,6 +319,14 @@ enum {
 	WNI_CFG_SAP_MAX_MCS_DATA,
 	WNI_CFG_RATE_FOR_TX_MGMT_2G,
 	WNI_CFG_RATE_FOR_TX_MGMT_5G,
+	WNI_CFG_EDCA_ETSI_ACBK_LOCAL,
+	WNI_CFG_EDCA_ETSI_ACBE_LOCAL,
+	WNI_CFG_EDCA_ETSI_ACVI_LOCAL,
+	WNI_CFG_EDCA_ETSI_ACVO_LOCAL,
+	WNI_CFG_EDCA_ETSI_ACBK,
+	WNI_CFG_EDCA_ETSI_ACBE,
+	WNI_CFG_EDCA_ETSI_ACVI,
+	WNI_CFG_EDCA_ETSI_ACVO,
 	/* Any new items to be added should be above this strictly */
 	CFG_PARAM_MAX_NUM
 };
@@ -362,6 +370,14 @@ enum {
 #define WNI_CFG_EDCA_WME_ACBE_LEN    20
 #define WNI_CFG_EDCA_WME_ACVI_LEN    20
 #define WNI_CFG_EDCA_WME_ACVO_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACBK_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACBE_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACVI_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACVO_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACBK_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACBE_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACVI_LEN    20
+#define WNI_CFG_EDCA_ETSI_ACVO_LEN    20
 #define WNI_CFG_SCAN_CONTROL_LIST_LEN    128
 #define WNI_CFG_SUPPORTED_MCS_SET_LEN    16
 #define WNI_CFG_BASIC_MCS_SET_LEN    16
@@ -748,7 +764,8 @@ enum {
 #define WNI_CFG_EDCA_PROFILE_ANI    0
 #define WNI_CFG_EDCA_PROFILE_WMM    1
 #define WNI_CFG_EDCA_PROFILE_TIT_DEMO    2
-#define WNI_CFG_EDCA_PROFILE_MAX    3
+#define WNI_CFG_EDCA_PROFILE_ETSI_EUROPE   3
+#define WNI_CFG_EDCA_PROFILE_MAX    4
 #define WNI_CFG_EDCA_PROFILE_ACM_IDX    0
 #define WNI_CFG_EDCA_PROFILE_AIFSN_IDX    1
 #define WNI_CFG_EDCA_PROFILE_CWMINA_IDX    2

+ 8 - 0
core/mac/src/cfg/cfg_param_name.c

@@ -332,4 +332,12 @@ unsigned char *g_cfg_param_name[] = {
 	(unsigned char *)"SAP_MAX_MCS_DATA",
 	(unsigned char *)"RATE_FOR_TX_MGMT_2G",
 	(unsigned char *)"RATE_FOR_TX_MGMT_5G",
+	(unsigned char *)"EDCA_ETSI_ACBK_LOCAL",
+	(unsigned char *)"EDCA_ETSI_ACBE_LOCAL",
+	(unsigned char *)"EDCA_ETSI_ACVI_LOCAL",
+	(unsigned char *)"EDCA_ETSI_ACVO_LOCAL",
+	(unsigned char *)"EDCA_ETSI_ACBK",
+	(unsigned char *)"EDCA_ETSI_ACBE",
+	(unsigned char *)"EDCA_ETSI_ACVI",
+	(unsigned char *)"EDCA_ETSI_ACVO",
 };

+ 71 - 4
core/mac/src/cfg/cfg_proc_msg.c

@@ -358,7 +358,7 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
 	WNI_CFG_NEW_BSS_FOUND_IND_STAMAX,
 	WNI_CFG_NEW_BSS_FOUND_IND_STADEF},
 	{WNI_CFG_COUNTRY_CODE,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_SCH,
 	0, 0, 0},
 	{WNI_CFG_11H_ENABLED,
 	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT |
@@ -1457,7 +1457,31 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
 	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
 	WNI_CFG_RATE_FOR_TX_MGMT_5G_STAMIN,
 	WNI_CFG_RATE_FOR_TX_MGMT_5G_STAMAX,
-	WNI_CFG_RATE_FOR_TX_MGMT_5G_STADEF}
+	WNI_CFG_RATE_FOR_TX_MGMT_5G_STADEF},
+	{WNI_CFG_EDCA_ETSI_ACBK_LOCAL,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACBE_LOCAL,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACVI_LOCAL,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACVO_LOCAL,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACBK,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACBE,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACVI,
+	 CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+	 0, 0, 0},
+	{WNI_CFG_EDCA_ETSI_ACVO,
+	 CFG_CTL_VALID | CFG_CTL_RE |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x0, 0x7, 0x2f} },
+	{WNI_CFG_EDCA_ETSI_ACBK,
+	 WNI_CFG_EDCA_ETSI_ACBK_LEN,
+	 17,
+	 {0x0, 0x7, 0x0, 0xf, 0x3, 0xff, 0xbb, 0x0, 0xf, 0x3, 0xff, 0x0, 0x0,
+	  0xf, 0x3, 0xff, 0x0} },
+	{WNI_CFG_EDCA_ETSI_ACBE,
+	 WNI_CFG_EDCA_ETSI_ACBE_LEN,
+	 17,
+	 {0x0, 0x3, 0x0, 0xf, 0x3, 0xff, 0xbb, 0x0, 0xf, 0x3, 0xff, 0x0, 0x0,
+	  0xf, 0x3, 0xff, 0x0} },
+	{WNI_CFG_EDCA_ETSI_ACVI,
+	 WNI_CFG_EDCA_ETSI_ACVI_LEN,
+	 17,
+	 {0x0, 0x2, 0x0, 0x7, 0x0, 0xf, 0x7d, 0x0, 0x7, 0x0, 0xf, 0xbc, 0x0,
+	  0x7, 0x0, 0xf, 0x5e} },
+	{WNI_CFG_EDCA_ETSI_ACVO,
+	 WNI_CFG_EDCA_ETSI_ACVO_LEN,
+	 17,
+	 {0x0, 0x2, 0x0, 0x3, 0x0, 0x7, 0x3e, 0x0, 0x3, 0x0, 0x7, 0x66, 0x0,
+	  0x3, 0x0, 0x7, 0x2f} },
 };
 
 /*--------------------------------------------------------------------*/
@@ -2360,8 +2424,11 @@ process_cfg_download_req(tpAniSirGlobal pMac)
 			uint8_t maxSavedLen;
 			if ((pMac->cfg.gCfgEntry[i].control & CFG_CTL_VALID) == 0)
 				continue;
-			if (index >= pMac->cfg.gCfgMaxSBufSize)
+			if (index >= pMac->cfg.gCfgMaxSBufSize) {
+				pe_debug("No space id:%d BufSize:%d index:%d",
+					 i, pMac->cfg.gCfgMaxSBufSize, index);
 				continue;
+			}
 
 			pDstTest = &pMac->cfg.gCfgSBuf[index];
 			pStrCfg = (cfgstatic_string*)cfg_static[i].pStrData;

+ 40 - 10
core/mac/src/pe/sch/sch_message.c

@@ -85,6 +85,18 @@ void sch_set_beacon_interval(tpAniSirGlobal pMac, tpPESession psessionEntry)
 	pMac->sch.schObject.gSchBeaconInterval = (uint16_t) bi;
 }
 
+static void sch_edca_profile_update_all(tpAniSirGlobal pmac)
+{
+	uint32_t i;
+	tpPESession psession_entry;
+
+	for (i = 0; i < pmac->lim.maxBssId; i++) {
+		psession_entry = &pmac->lim.gpSession[i];
+		if (psession_entry->valid)
+			sch_edca_profile_update(pmac, psession_entry);
+	}
+}
+
 /* -------------------------------------------------------------------- */
 /**
  * sch_process_message
@@ -103,17 +115,10 @@ void sch_set_beacon_interval(tpAniSirGlobal pMac, tpPESession psessionEntry)
 
 void sch_process_message(tpAniSirGlobal pMac, struct scheduler_msg *pSchMsg)
 {
-	uint32_t val;
-
 	tpPESession psessionEntry = &pMac->lim.gpSession[0];
 
 	switch (pSchMsg->type) {
 	case SIR_CFG_PARAM_UPDATE_IND:
-
-		if (wlan_cfg_get_int(pMac, (uint16_t) pSchMsg->bodyval, &val) !=
-		    eSIR_SUCCESS)
-			pe_err("failed to cfg get id %d", pSchMsg->bodyval);
-
 		switch (pSchMsg->bodyval) {
 		case WNI_CFG_BEACON_INTERVAL:
 			/* What to do for IBSS ?? - TBD */
@@ -121,6 +126,11 @@ void sch_process_message(tpAniSirGlobal pMac, struct scheduler_msg *pSchMsg)
 				sch_set_beacon_interval(pMac, psessionEntry);
 			break;
 
+		case WNI_CFG_COUNTRY_CODE:
+			pe_debug("sch: WNI_CFG_COUNTRY_CODE changed");
+			sch_edca_profile_update_all(pMac);
+			break;
+
 		case WNI_CFG_EDCA_PROFILE:
 			sch_edca_profile_update(pMac, psessionEntry);
 			break;
@@ -172,19 +182,33 @@ sch_get_params(tpAniSirGlobal pMac,
 	uint32_t val;
 	uint32_t i, idx;
 	uint32_t *prf;
-
+	uint8_t country_code_str[WNI_CFG_COUNTRY_CODE_LEN];
+	uint32_t country_code_len = WNI_CFG_COUNTRY_CODE_LEN;
 	uint32_t ani_l[] = {
 	  WNI_CFG_EDCA_ANI_ACBE_LOCAL, WNI_CFG_EDCA_ANI_ACBK_LOCAL,
 	  WNI_CFG_EDCA_ANI_ACVI_LOCAL, WNI_CFG_EDCA_ANI_ACVO_LOCAL};
 	uint32_t wme_l[] = {
 	  WNI_CFG_EDCA_WME_ACBE_LOCAL, WNI_CFG_EDCA_WME_ACBK_LOCAL,
 	  WNI_CFG_EDCA_WME_ACVI_LOCAL, WNI_CFG_EDCA_WME_ACVO_LOCAL};
+	uint32_t etsi_l[] = {WNI_CFG_EDCA_ETSI_ACBE_LOCAL,
+			WNI_CFG_EDCA_ETSI_ACBK_LOCAL,
+			WNI_CFG_EDCA_ETSI_ACVI_LOCAL,
+			WNI_CFG_EDCA_ETSI_ACVO_LOCAL};
 	uint32_t ani_b[] = { WNI_CFG_EDCA_ANI_ACBE, WNI_CFG_EDCA_ANI_ACBK,
 			     WNI_CFG_EDCA_ANI_ACVI, WNI_CFG_EDCA_ANI_ACVO};
 	uint32_t wme_b[] = { WNI_CFG_EDCA_WME_ACBE, WNI_CFG_EDCA_WME_ACBK,
 			     WNI_CFG_EDCA_WME_ACVI, WNI_CFG_EDCA_WME_ACVO};
-
-	if (wlan_cfg_get_int(pMac, WNI_CFG_EDCA_PROFILE, &val) != eSIR_SUCCESS) {
+	uint32_t etsi_b[] = {WNI_CFG_EDCA_ETSI_ACBE, WNI_CFG_EDCA_ETSI_ACBK,
+			WNI_CFG_EDCA_ETSI_ACVI, WNI_CFG_EDCA_ETSI_ACVO};
+
+	if (wlan_cfg_get_str(pMac, WNI_CFG_COUNTRY_CODE, country_code_str,
+			     &country_code_len) == eSIR_SUCCESS &&
+	    cds_is_etsi_europe_country(country_code_str)) {
+		val = WNI_CFG_EDCA_PROFILE_ETSI_EUROPE;
+		pe_debug("switch to ETSI EUROPE profile country code %c%c",
+			 country_code_str[0], country_code_str[1]);
+	} else if (wlan_cfg_get_int(pMac, WNI_CFG_EDCA_PROFILE, &val) !=
+		   eSIR_SUCCESS) {
 		pe_err("failed to cfg get EDCA_PROFILE id %d",
 			WNI_CFG_EDCA_PROFILE);
 		return eSIR_FAILURE;
@@ -204,6 +228,9 @@ sch_get_params(tpAniSirGlobal pMac,
 		case WNI_CFG_EDCA_PROFILE_WMM:
 			prf = &wme_l[0];
 			break;
+		case WNI_CFG_EDCA_PROFILE_ETSI_EUROPE:
+			prf = &etsi_l[0];
+			break;
 		case WNI_CFG_EDCA_PROFILE_ANI:
 		default:
 			prf = &ani_l[0];
@@ -214,6 +241,9 @@ sch_get_params(tpAniSirGlobal pMac,
 		case WNI_CFG_EDCA_PROFILE_WMM:
 			prf = &wme_b[0];
 			break;
+		case WNI_CFG_EDCA_PROFILE_ETSI_EUROPE:
+			prf = &etsi_b[0];
+			break;
 		case WNI_CFG_EDCA_PROFILE_ANI:
 		default:
 			prf = &ani_b[0];