summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/cds/src/cds_reg_service.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c
index 302c670c0aca..9b6b00d8d079 100644
--- a/core/cds/src/cds_reg_service.c
+++ b/core/cds/src/cds_reg_service.c
@@ -436,6 +436,23 @@ enum channel_state cds_get_5g_bonded_channel_state(
return CHANNEL_STATE_DISABLE;
}
+/**
+ * cds_combine_channel_states() - combine channel states
+ * @chan_state1: channel state1
+ * @chan_state2: channel state2
+ *
+ * Return: enum channel_state
+ */
+ static enum channel_state cds_combine_channel_states(
+ enum channel_state chan_state1,
+ enum channel_state chan_state2)
+{
+ if ((CHANNEL_STATE_INVALID == chan_state1) ||
+ (CHANNEL_STATE_INVALID == chan_state2))
+ return CHANNEL_STATE_INVALID;
+ else
+ return min(chan_state1, chan_state2);
+}
/**
* cds_set_5g_channel_params() - set the 5G bonded channel parameters
@@ -456,6 +473,8 @@ static void cds_set_5g_channel_params(uint16_t oper_ch,
ch_params->ch_width = CH_WIDTH_80P80MHZ;
while (ch_params->ch_width != CH_WIDTH_INVALID) {
+ bonded_chan_ptr = NULL;
+ bonded_chan_ptr2 = NULL;
chan_state = cds_search_5g_bonded_channel(oper_ch,
ch_params->ch_width,
&bonded_chan_ptr);
@@ -468,14 +487,16 @@ static void cds_set_5g_channel_params(uint16_t oper_ch,
ch_params->center_freq_seg1 - 2,
CH_WIDTH_80MHZ);
- if (chan_state2 < chan_state)
- chan_state = chan_state2;
+ chan_state = cds_combine_channel_states(chan_state,
+ chan_state2);
+
if ((CHANNEL_STATE_ENABLE == chan_state) ||
(CHANNEL_STATE_DFS == chan_state)) {
if (CH_WIDTH_20MHZ >= ch_params->ch_width) {
ch_params->sec_ch_offset
= PHY_SINGLE_CHANNEL_CENTERED;
ch_params->center_freq_seg0 = oper_ch;
+ break;
} else if (CH_WIDTH_40MHZ <= ch_params->ch_width) {
cds_search_5g_bonded_chan_array(oper_ch,
bonded_chan_40mhz_array,
@@ -493,9 +514,9 @@ static void cds_set_5g_channel_params(uint16_t oper_ch,
ch_params->center_freq_seg0 =
(bonded_chan_ptr->start_ch +
bonded_chan_ptr->end_ch)/2;
+ break;
}
}
- break;
}
ch_params->ch_width = next_lower_bw[ch_params->ch_width];
}