|
@@ -1193,9 +1193,9 @@ int wlan_hdd_send_hang_reason_event(struct hdd_context *hdd_ctx,
|
|
|
#undef HANG_REASON_INDEX
|
|
|
|
|
|
/**
|
|
|
- * wlan_hdd_get_adjacent_chan(): Gets next/previous channel
|
|
|
+ * wlan_hdd_get_adjacent_chan_freq(): Gets next/previous channel
|
|
|
* with respect to the channel passed.
|
|
|
- * @chan: Channel
|
|
|
+ * @freq: Channel frequency
|
|
|
* @upper: If "true" then next channel is returned or else
|
|
|
* previous channel is returned.
|
|
|
*
|
|
@@ -1203,9 +1203,9 @@ int wlan_hdd_send_hang_reason_event(struct hdd_context *hdd_ctx,
|
|
|
* the channel passed. If "upper = true" then next channel is
|
|
|
* returned else previous is returned.
|
|
|
*/
|
|
|
-int wlan_hdd_get_adjacent_chan(uint8_t chan, bool upper)
|
|
|
+static qdf_freq_t wlan_hdd_get_adjacent_chan_freq(qdf_freq_t freq, bool upper)
|
|
|
{
|
|
|
- enum channel_enum ch_idx = wlan_reg_get_chan_enum(chan);
|
|
|
+ enum channel_enum ch_idx = wlan_reg_get_chan_enum_for_freq(freq);
|
|
|
|
|
|
if (ch_idx == INVALID_CHANNEL)
|
|
|
return -EINVAL;
|
|
@@ -1217,28 +1217,29 @@ int wlan_hdd_get_adjacent_chan(uint8_t chan, bool upper)
|
|
|
else
|
|
|
return -EINVAL;
|
|
|
|
|
|
- return WLAN_REG_CH_NUM(ch_idx);
|
|
|
+ return WLAN_REG_CH_TO_FREQ(ch_idx);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* wlan_hdd_send_avoid_freq_for_dnbs(): Sends list of frequencies to be
|
|
|
* avoided when Do_Not_Break_Stream is active.
|
|
|
* @hdd_ctx: HDD Context
|
|
|
- * @op_chan: AP/P2P-GO operating channel
|
|
|
+ * @op_freq: AP/P2P-GO operating channel frequency
|
|
|
*
|
|
|
* This function sends list of frequencies to be avoided when
|
|
|
* Do_Not_Break_Stream is active.
|
|
|
* To clear the avoid_frequency_list in the application,
|
|
|
- * op_chan = 0 can be passed.
|
|
|
+ * op_freq = 0 can be passed.
|
|
|
*
|
|
|
* Return: 0 on success and errno on failure
|
|
|
*/
|
|
|
-int wlan_hdd_send_avoid_freq_for_dnbs(struct hdd_context *hdd_ctx, uint8_t op_chan)
|
|
|
+int wlan_hdd_send_avoid_freq_for_dnbs(struct hdd_context *hdd_ctx,
|
|
|
+ qdf_freq_t op_freq)
|
|
|
{
|
|
|
struct ch_avoid_ind_type p2p_avoid_freq_list;
|
|
|
- uint8_t min_chan, max_chan;
|
|
|
+ qdf_freq_t min_freq, max_freq;
|
|
|
int ret;
|
|
|
- int chan;
|
|
|
+ qdf_freq_t freq;
|
|
|
|
|
|
hdd_enter();
|
|
|
|
|
@@ -1251,7 +1252,7 @@ int wlan_hdd_send_avoid_freq_for_dnbs(struct hdd_context *hdd_ctx, uint8_t op_ch
|
|
|
/*
|
|
|
* If channel passed is zero, clear the avoid_freq list in application.
|
|
|
*/
|
|
|
- if (!op_chan) {
|
|
|
+ if (!op_freq) {
|
|
|
#ifdef FEATURE_WLAN_CH_AVOID
|
|
|
mutex_lock(&hdd_ctx->avoid_freq_lock);
|
|
|
qdf_mem_zero(&hdd_ctx->dnbs_avoid_freq_list,
|
|
@@ -1271,59 +1272,51 @@ int wlan_hdd_send_avoid_freq_for_dnbs(struct hdd_context *hdd_ctx, uint8_t op_ch
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- if (WLAN_REG_IS_24GHZ_CH(op_chan)) {
|
|
|
- min_chan = WLAN_REG_MIN_24GHZ_CH_NUM;
|
|
|
- max_chan = WLAN_REG_MAX_24GHZ_CH_NUM;
|
|
|
- } else if (WLAN_REG_IS_5GHZ_CH(op_chan)) {
|
|
|
- min_chan = WLAN_REG_MIN_5GHZ_CH_NUM;
|
|
|
- max_chan = WLAN_REG_MAX_5GHZ_CH_NUM;
|
|
|
+ if (WLAN_REG_IS_24GHZ_CH_FREQ(op_freq)) {
|
|
|
+ min_freq = WLAN_REG_MIN_24GHZ_CHAN_FREQ;
|
|
|
+ max_freq = WLAN_REG_MAX_24GHZ_CHAN_FREQ;
|
|
|
+ } else if (WLAN_REG_IS_5GHZ_CH_FREQ(op_freq)) {
|
|
|
+ min_freq = WLAN_REG_MIN_5GHZ_CHAN_FREQ;
|
|
|
+ max_freq = WLAN_REG_MAX_5GHZ_CHAN_FREQ;
|
|
|
} else {
|
|
|
- hdd_err("invalid channel:%d", op_chan);
|
|
|
+ hdd_err("invalid channel freq:%d", op_freq);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- if ((op_chan > min_chan) && (op_chan < max_chan)) {
|
|
|
+ if (op_freq > min_freq && op_freq < max_freq) {
|
|
|
p2p_avoid_freq_list.ch_avoid_range_cnt = 2;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].start_freq =
|
|
|
- wlan_chan_to_freq(min_chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].start_freq = min_freq;
|
|
|
|
|
|
- /* Get channel before the op_chan */
|
|
|
- chan = wlan_hdd_get_adjacent_chan(op_chan, false);
|
|
|
- if (chan < 0)
|
|
|
+ /* Get channel before the op_freq */
|
|
|
+ freq = wlan_hdd_get_adjacent_chan_freq(op_freq, false);
|
|
|
+ if (freq < 0)
|
|
|
return -EINVAL;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].end_freq =
|
|
|
- wlan_chan_to_freq(chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].end_freq = freq;
|
|
|
|
|
|
- /* Get channel next to the op_chan */
|
|
|
- chan = wlan_hdd_get_adjacent_chan(op_chan, true);
|
|
|
- if (chan < 0)
|
|
|
+ /* Get channel next to the op_freq */
|
|
|
+ freq = wlan_hdd_get_adjacent_chan_freq(op_freq, true);
|
|
|
+ if (freq < 0)
|
|
|
return -EINVAL;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[1].start_freq =
|
|
|
- wlan_chan_to_freq(chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[1].start_freq = freq;
|
|
|
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[1].end_freq =
|
|
|
- wlan_chan_to_freq(max_chan);
|
|
|
- } else if (op_chan == min_chan) {
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[1].end_freq = max_freq;
|
|
|
+ } else if (op_freq == min_freq) {
|
|
|
p2p_avoid_freq_list.ch_avoid_range_cnt = 1;
|
|
|
|
|
|
- chan = wlan_hdd_get_adjacent_chan(op_chan, true);
|
|
|
- if (chan < 0)
|
|
|
+ freq = wlan_hdd_get_adjacent_chan_freq(op_freq, true);
|
|
|
+ if (freq < 0)
|
|
|
return -EINVAL;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].start_freq =
|
|
|
- wlan_chan_to_freq(chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].start_freq = freq;
|
|
|
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].end_freq =
|
|
|
- wlan_chan_to_freq(max_chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].end_freq = max_freq;
|
|
|
} else {
|
|
|
p2p_avoid_freq_list.ch_avoid_range_cnt = 1;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].start_freq =
|
|
|
- wlan_chan_to_freq(min_chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].start_freq = min_freq;
|
|
|
|
|
|
- chan = wlan_hdd_get_adjacent_chan(op_chan, false);
|
|
|
- if (chan < 0)
|
|
|
+ freq = wlan_hdd_get_adjacent_chan_freq(op_freq, false);
|
|
|
+ if (freq < 0)
|
|
|
return -EINVAL;
|
|
|
- p2p_avoid_freq_list.avoid_freq_range[0].end_freq =
|
|
|
- wlan_chan_to_freq(chan);
|
|
|
+ p2p_avoid_freq_list.avoid_freq_range[0].end_freq = freq;
|
|
|
}
|
|
|
#ifdef FEATURE_WLAN_CH_AVOID
|
|
|
mutex_lock(&hdd_ctx->avoid_freq_lock);
|