Browse Source

qcacmn: Fixes for regulatory channel event processing

Fix the population of tx power. Also fix the WMI TLV processing
for regulatory channel list event. Also make sure correct
range enums are calculated for pdev range.

Change-Id: Iec9559c0ab4b2b5e52d0b0a3eb4a0e8d038dc791
CRs-Fixed: 2002892
Kiran Kumar Lokere 8 years ago
parent
commit
43568a9b3f
3 changed files with 22 additions and 18 deletions
  1. 1 0
      qdf/linux/src/qdf_trace.c
  2. 17 16
      umac/regulatory/core/src/reg_services.c
  3. 4 2
      wmi/src/wmi_unified_tlv.c

+ 1 - 0
qdf/linux/src/qdf_trace.c

@@ -88,6 +88,7 @@ module_trace_info g_qdf_trace_info[QDF_MODULE_ID_MAX] = {
 	[QDF_MODULE_ID_TXRX] = {QDF_DEFAULT_TRACE_LEVEL, "TRX"},
 	[QDF_MODULE_ID_HTT] = {QDF_DEFAULT_TRACE_LEVEL, "HTT"},
 	[QDF_MODULE_ID_SERIALIZATION] = {QDF_DEFAULT_TRACE_LEVEL, "SER"},
+	[QDF_MODULE_ID_REGULATORY] = {QDF_DEFAULT_TRACE_LEVEL, "REG"},
 };
 
 /* Static and Global variables */

+ 17 - 16
umac/regulatory/core/src/reg_services.c

@@ -1076,6 +1076,7 @@ static void reg_fill_channel_info(enum channel_enum chan_enum,
 	master_list[chan_enum].chan_flags &=
 		~REGULATORY_CHAN_DISABLED;
 
+	master_list[chan_enum].tx_power = reg_rule->reg_power;
 	master_list[chan_enum].state = CHANNEL_STATE_ENABLE;
 
 	if (reg_rule->flags & REGULATORY_CHAN_NO_IR) {
@@ -1437,32 +1438,32 @@ modify_chan_list_for_freq_range(struct regulatory_channel
 		low_limit_5g = 0, high_limit_5g = 0, chan_enum;
 	bool chan_in_range;
 
-	for (chan_enum = 0; chan_enum < NUM_CHANNELS && !low_limit_2g;
-	     chan_enum++) {
-		if ((chan_list[chan_enum].center_freq - 10) >=
-		    low_freq_2g)
+	for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
+		if ((chan_list[chan_enum].center_freq - 10) >= low_freq_2g) {
 			low_limit_2g = chan_enum;
+			break;
+		}
 	}
 
-	for (chan_enum = 0; chan_enum < NUM_CHANNELS && !low_limit_5g;
-	     chan_enum++) {
-		if ((chan_list[chan_enum].center_freq - 10) >=
-		    low_freq_5g)
+	for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
+		if ((chan_list[chan_enum].center_freq - 10) >= low_freq_5g) {
 			low_limit_5g = chan_enum;
+			break;
+		}
 	}
 
-	for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0 &&
-		     !high_limit_2g; chan_enum--) {
-		if (chan_list[chan_enum].center_freq + 10 <=
-		    high_freq_2g)
+	for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) {
+		if (chan_list[chan_enum].center_freq + 10 <= high_freq_2g) {
 			high_limit_2g = chan_enum;
+			break;
+		}
 	}
 
-	for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0 &&
-		     !high_limit_5g; chan_enum--) {
-		if (chan_list[chan_enum].center_freq + 10 <=
-		    high_freq_5g)
+	for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) {
+		if (chan_list[chan_enum].center_freq + 10 <= high_freq_5g) {
 			high_limit_5g = chan_enum;
+			break;
+		}
 	}
 
 	for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {

+ 4 - 2
wmi/src/wmi_unified_tlv.c

@@ -16188,9 +16188,11 @@ static QDF_STATUS extract_reg_chan_list_update_event_tlv(
 	num_2g_reg_rules = reg_info->num_2g_reg_rules;
 	num_5g_reg_rules = reg_info->num_5g_reg_rules;
 
-	wmi_reg_rule = (wmi_regulatory_rule_struct *)(chan_list_event_hdr
-			+ sizeof(wmi_reg_chan_list_cc_event_fixed_param));
 
+	wmi_reg_rule =
+		(wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr
+			+ sizeof(wmi_reg_chan_list_cc_event_fixed_param)
+			+ WMI_TLV_HDR_SIZE);
 	reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules,
 			wmi_reg_rule);
 	wmi_reg_rule += num_2g_reg_rules;