From 43568a9b3fdb215d06f6da525115bfb4ef328e64 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Fri, 31 Mar 2017 15:50:26 -0700 Subject: [PATCH] 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 --- qdf/linux/src/qdf_trace.c | 1 + umac/regulatory/core/src/reg_services.c | 33 +++++++++++++------------ wmi/src/wmi_unified_tlv.c | 6 +++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/qdf/linux/src/qdf_trace.c b/qdf/linux/src/qdf_trace.c index e12e3e762a9c..07db48d3c399 100644 --- a/qdf/linux/src/qdf_trace.c +++ b/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 */ diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 248f6399474d..0d2390bf1553 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/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++) { diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 0761fd0e432f..ed70bdfbd567 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/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;