Bläddra i källkod

qcacmn: Search opclass from global opclass also

While querying for the channel width, the opclass is
extracted from the country opclass. If opclass is not
found then 20Mhz channel width is considered for connection.
This fails the cert test case when AP sends the global
opclass in ECSA

Change is done to search in the global opclass if the
opclass is not found in the country specific opclass.

CRs-Fixed: 2763702
Change-Id: If8c962e1e164cfccda13f19cbf925499c9cc0394
Sachin Ahuja 4 år sedan
förälder
incheckning
d1f2d7a868

+ 18 - 0
umac/regulatory/core/src/reg_opclass.c

@@ -357,6 +357,24 @@ uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel,
 	return 0;
 }
 
+uint16_t reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
+						 uint8_t channel,
+						 uint8_t opclass)
+{
+	uint16_t ret;
+	uint8_t global_country[REG_ALPHA2_LEN + 1];
+
+	ret = reg_dmn_get_chanwidth_from_opclass(country, channel, opclass);
+
+	if (!ret) {
+		global_country[2] = OP_CLASS_GLOBAL;
+		ret = reg_dmn_get_chanwidth_from_opclass(global_country,
+							 channel, opclass);
+	}
+
+	return ret;
+}
+
 uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
 					  uint8_t offset)
 {

+ 15 - 1
umac/regulatory/core/src/reg_opclass.h

@@ -426,6 +426,20 @@ reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class,
 {
 	return 0;
 }
-
 #endif
+
+/**
+ * reg_dmn_get_chanwidth_from_opclass_auto()- Get channel width for the
+ * given channel and opclass. If not found then search it in the global
+ * op class.
+ * @country - Country
+ * @channel - Channel for which channel spacing is required
+ * @opclass - Opclass to search from.
+ *
+ * Return: valid channel spacing if found. If not found then
+ * return 0.
+ */
+uint16_t reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
+						 uint8_t channel,
+						 uint8_t opclass);
 #endif

+ 14 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -757,6 +757,20 @@ void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country,
 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
 						 uint8_t channel,
 						 uint8_t opclass);
+
+/**
+ * wlan_reg_dmn_get_chanwidth_from_opclass_auto() - get channel width from
+ * operating class. If opclass not found then search in global opclass.
+ * @country: country alpha2
+ * @channel: channel number
+ * @opclass: operating class
+ *
+ * Return: int
+ */
+uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
+						      uint8_t channel,
+						      uint8_t opclass);
+
 /**
  * wlan_reg_dmn_set_curr_opclasses() - set operating class
  * @num_classes: number of classes

+ 8 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -316,6 +316,14 @@ uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
 						  opclass);
 }
 
+uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
+						      uint8_t channel,
+						      uint8_t opclass)
+{
+	return reg_dmn_get_chanwidth_from_opclass_auto(country, channel,
+						       opclass);
+}
+
 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,
 					 uint8_t *class)
 {