Merge "qcacmn: Stop the opportunistic timer when hdd stop happens"

This commit is contained in:
Linux Build Service Account 2017-11-05 01:24:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit aa6d7e52a8
21 changed files with 346 additions and 552 deletions

View file

@ -501,6 +501,7 @@ enum _ol_ath_param_t {
OL_ATH_PARAM_ICM_ACTIVE = 357,
OL_ATH_PARAM_NOMINAL_NOISEFLOOR = 358,
OL_ATH_PARAM_CHAN_INFO = 359,
OL_ATH_PARAM_ACS_RANK = 360,
};
/* Enumeration of PDEV Configuration parameter */

View file

@ -1393,7 +1393,10 @@ static void dp_process_ppdu_stats_user_common_tlv(
} else {
ppdu_user_desc->mpdu_tried_ucast =
HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(*tag_buf);
}
}
tag_buf++;
ppdu_user_desc->qos_ctrl =
HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_GET(*tag_buf);
ppdu_user_desc->frame_ctrl =
@ -1438,7 +1441,12 @@ static void dp_process_ppdu_stats_user_rate_tlv(struct dp_pdev *pdev,
qdf_mem_copy(ppdu_user_desc->mac_addr, peer->mac_addr.raw,
DP_MAC_ADDR_LEN);
tag_buf += 5;
tag_buf += 4;
ppdu_user_desc->ppdu_type =
HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(*tag_buf);
tag_buf++;
ppdu_user_desc->ltf_size =
HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(*tag_buf);
@ -1457,8 +1465,6 @@ static void dp_process_ppdu_stats_user_rate_tlv(struct dp_pdev *pdev,
ppdu_user_desc->gi = HTT_PPDU_STATS_USER_RATE_TLV_GI_GET(*tag_buf);
ppdu_user_desc->dcm = HTT_PPDU_STATS_USER_RATE_TLV_DCM_GET(*tag_buf);
ppdu_user_desc->ldpc = HTT_PPDU_STATS_USER_RATE_TLV_LDPC_GET(*tag_buf);
ppdu_user_desc->ppdu_type =
HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(*tag_buf);
}
/*
@ -1728,7 +1734,7 @@ static void dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv(
ppdu_user_desc = &ppdu_desc->user[curr_user_index];
ppdu_user_desc->peer_id = peer_id;
tag_buf += 2;
tag_buf++;
ppdu_user_desc->num_mpdu =
HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_GET(*tag_buf);

View file

@ -122,4 +122,26 @@ struct dfs_ioctl_params {
#define DFS_IOCTL_PARAM_NOVAL 65535
#define DFS_IOCTL_PARAM_ENABLE 0x8000
/* Random channel flags */
/* Flag to exclude current operating channels */
#define DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH 0x0001 /* 0000 0000 0000 0001 */
/* Flag to exclude weather channels */
#define DFS_RANDOM_CH_FLAG_NO_WEATHER_CH 0x0002 /* 0000 0000 0000 0010 */
/* Flag to exclude indoor channels */
#define DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH 0x0004 /* 0000 0000 0000 0100 */
/* Flag to exclude outdoor channels */
#define DFS_RANDOM_CH_FLAG_NO_UPEER_5G_CH 0x0008 /* 0000 0000 0000 1000 */
/* Flag to exclude dfs channels */
#define DFS_RANDOM_CH_FLAG_NO_DFS_CH 0x0010 /* 0000 0000 0001 0000 */
/* Flag to exclude all 5GHz channels */
#define DFS_RANDOM_CH_FLAG_NO_5GHZ_CH 0x0020 /* 0000 0000 0010 0000 */
/* Flag to exclude all 2.4GHz channels */
#define DFS_RANDOM_CH_FLAG_NO_2GHZ_CH 0x0040 /* 0000 0000 0100 0000 */
#endif /* _DFS_IOCTL_H_ */

View file

@ -2129,5 +2129,33 @@ void policy_mgr_set_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc,
* Return: conc_system_pref
*/
uint8_t policy_mgr_get_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc);
/**
* policy_mgr_check_and_stop_opportunistic_timer - Get current
* state of opportunistic timer, if running, stop it and take
* action
* @psoc: soc pointer
*
* Get the current state of opportunistic timer, if it is
* running, stop it and take action.
*
* Return: None
*/
void policy_mgr_check_and_stop_opportunistic_timer(
struct wlan_objmgr_psoc *psoc);
/**
* policy_mgr_set_weight_of_dfs_passive_channels_to_zero() - set weight of dfs
* and passive channels to 0
* @psoc: pointer to soc
* @pcl_channels: preferred channel list
* @len: length of preferred channel list
* @weight_list: preferred channel weight list
* @weight_len: length of weight list
* This function set the weight of dfs and passive channels to 0
*
* Return: None
*/
void policy_mgr_set_weight_of_dfs_passive_channels_to_zero(
struct wlan_objmgr_psoc *psoc, uint8_t *pcl_channels,
uint32_t *len, uint8_t *weight_list, uint32_t weight_len);
#endif /* __WLAN_POLICY_MGR_API_H */

View file

@ -896,6 +896,7 @@ struct policy_mgr_hw_mode {
void *set_hw_mode_cb;
enum policy_mgr_conn_update_reason reason;
uint32_t session_id;
struct wlan_objmgr_vdev *vdev;
struct wlan_objmgr_psoc *context;
};

View file

@ -1092,6 +1092,23 @@ void policy_mgr_checkn_update_hw_mode_single_mac_mode(
pm_dbs_opportunistic_timer_handler((void *)psoc);
}
void policy_mgr_check_and_stop_opportunistic_timer(
struct wlan_objmgr_psoc *psoc)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return;
}
if (QDF_TIMER_STATE_RUNNING ==
pm_ctx->dbs_opportunistic_timer.state) {
qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer);
pm_dbs_opportunistic_timer_handler((void *)psoc);
}
}
void policy_mgr_set_hw_mode_change_in_progress(
struct wlan_objmgr_psoc *psoc, enum policy_mgr_hw_mode_change value)
{

View file

@ -1674,6 +1674,68 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc,
return status;
}
/**
* policy_mgr_set_weight_of_dfs_passive_channels_to_zero() - set weight of dfs
* and passive channels to 0
* @psoc: pointer to soc
* @pcl_channels: preferred channel list
* @len: length of preferred channel list
* @weight_list: preferred channel weight list
* @weight_len: length of weight list
* This function set the weight of dfs and passive channels to 0
*
* Return: None
*/
void policy_mgr_set_weight_of_dfs_passive_channels_to_zero(
struct wlan_objmgr_psoc *psoc, uint8_t *pcl_channels,
uint32_t *len, uint8_t *weight_list, uint32_t weight_len)
{
uint8_t i;
uint32_t orig_channel_count = 0;
bool mcc_to_scc_mode;
uint32_t sap_count;
enum channel_state channel_state;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return;
}
mcc_to_scc_mode = policy_mgr_is_force_scc(psoc);
sap_count = policy_mgr_mode_specific_connection_count(psoc,
PM_SAP_MODE, NULL);
policy_mgr_debug("mcc_to_scc_mode %u, sap_count %u", mcc_to_scc_mode,
sap_count);
if (!mcc_to_scc_mode || !sap_count)
return;
if (len)
orig_channel_count = QDF_MIN(*len, QDF_MAX_NUM_CHAN);
else {
policy_mgr_err("invalid number of channel length");
return;
}
policy_mgr_debug("Set weight of DFS/passive channels to 0");
for (i = 0; i < orig_channel_count; i++) {
channel_state = reg_get_channel_state(pm_ctx->pdev,
pcl_channels[i]);
if ((channel_state == CHANNEL_STATE_DISABLE) ||
(channel_state == CHANNEL_STATE_INVALID))
/* Set weight of inactive channels to 0 */
weight_list[i] = 0;
policy_mgr_debug("chan[%d] - %d, weight[%d] - %d",
i, pcl_channels[i], i, weight_list[i]);
}
return;
}
/**
* policy_mgr_get_channel_list() - provides the channel list
* suggestion for new connection
@ -2119,6 +2181,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
policy_mgr_update_with_safe_channel_list(psoc, pcl_channels, len,
pcl_weights, weight_len);
policy_mgr_set_weight_of_dfs_passive_channels_to_zero(psoc,
pcl_channels, len, pcl_weights, weight_len);
return status;
}

View file

@ -887,6 +887,7 @@ struct wlan_dfs {
* @WLAN_DEBUG_DFS_BIN5_FFT: BIN5 FFT check.
* @WLAN_DEBUG_DFS_BIN5_PULSE: BIN5 pulse check.
* @WLAN_DEBUG_DFS_FALSE_DET: False detection debug related prints.
* @WLAN_DEBUG_DFS_RANDOM_CHAN: Random channel selection.
*/
enum {
WLAN_DEBUG_DFS = 0x00000100,
@ -901,6 +902,7 @@ enum {
WLAN_DEBUG_DFS_BIN5_FFT = 0x00020000,
WLAN_DEBUG_DFS_BIN5_PULSE = 0x00040000,
WLAN_DEBUG_DFS_FALSE_DET = 0x00080000,
WLAN_DEBUG_DFS_RANDOM_CHAN = 0x00100000,
WLAN_DEBUG_DFS_MAX = 0x80000000,
WLAN_DEBUG_DFS_ALWAYS = WLAN_DEBUG_DFS_MAX
};
@ -1475,18 +1477,6 @@ int dfs_create_object(struct wlan_dfs **dfs);
*/
void dfs_destroy_object(struct wlan_dfs *dfs);
/**
* dfs_random_channel() - Function to choose the random channel from the current
* channel list.
* @dfs: Pointer to wlan_dfs structure.
* @is_select_nondfs: Select NON-DFS chan or both NON-DFS and DFS.
* @skip_curchan: Select the next channel post radar detecr and skip the
* curchan.
*/
int dfs_random_channel(struct wlan_dfs *dfs,
uint8_t is_select_nondfs,
uint8_t skip_curchan);
/**
* dfs_detach() - Wrapper function to free dfs variables.
* @dfs: Pointer to wlan_dfs structure.

View file

@ -51,11 +51,6 @@ enum DFS_DOMAIN {
/* CAPABILITY: the device support STA DFS */
#define IEEE80211_CEXT_STADFS 0x00000040
#define IEEE80211_SELECT_NONDFS_AND_DFS 0
#define IEEE80211_SELECT_NONDFS_ONLY 1
#define IEEE80211_SELECT_NXT_CH_POST_RADAR_DETECT 0
#define IEEE80211_SELECT_APRIORI_NXT_CH 1
/**
* dfs_ieee80211_chan2freq() - Convert channel to frequency value.
* @chan: Pointer to dfs_ieee80211_channel structure.

View file

@ -75,28 +75,6 @@
/* Max channel width */
#define DFS_CH_WIDTH_MAX 8
/* Random channel flags */
/* Flag to exclude current operating channels */
#define DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH 0x0001 /* 0000 0000 0000 0001 */
/* Flag to exclude weather channels */
#define DFS_RANDOM_CH_FLAG_NO_WEATHER_CH 0x0002 /* 0000 0000 0000 0010 */
/* Flag to exclude indoor channels */
#define DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH 0x0004 /* 0000 0000 0000 0100 */
/* Flag to exclude outdoor channels */
#define DFS_RANDOM_CH_FLAG_NO_UPEER_5G_CH 0x0008 /* 0000 0000 0000 1000 */
/* Flag to exclude dfs channels */
#define DFS_RANDOM_CH_FLAG_NO_DFS_CH 0x0010 /* 0000 0000 0001 0000 */
/* Flag to exclude all 5GHz channels */
#define DFS_RANDOM_CH_FLAG_NO_5GHZ_CH 0x0020 /* 0000 0000 0010 0000 */
/* Flag to exclude all 2.4GHz channels */
#define DFS_RANDOM_CH_FLAG_NO_2GHZ_CH 0x0040 /* 0000 0000 0100 0000 */
/* Next 5GHz channel number */
#define DFS_80_NUM_SUB_CHANNNEL 4
@ -124,9 +102,12 @@
/* Bitmap mask for 40MHz higher */
#define DFS_40MHZ_MASK_H 0x0C
/* Adjacent weather radar channel */
/* Adjacent weather radar channel frequency */
#define DFS_ADJACENT_WEATHER_RADAR_CHANNEL 5580
/* Adjacent weather radar channel number */
#define DFS_ADJACENT_WEATHER_RADAR_CHANNEL_NUM 116
/* Max 2.4 GHz channel number */
#define DFS_MAX_24GHZ_CHANNEL 14

View file

@ -677,28 +677,8 @@ int dfs_control(struct wlan_dfs *dfs,
qdf_mem_zero(&dfs_unit_test, sizeof(dfs_unit_test));
/* dfs is dereferenced (dfs->dfs_ignore_dfs) when dfs is NULL */
if (!dfs) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
/*
* Enable/Disable DFS can be done prior to attach,
* So handle here.
*/
switch (id) {
case DFS_DISABLE_DETECT:
dfs->dfs_ignore_dfs = 1;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "enable detects, ignore_dfs %d",
dfs->dfs_ignore_dfs ? 1:0);
break;
case DFS_ENABLE_DETECT:
dfs->dfs_ignore_dfs = 0;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "enable detects, ignore_dfs %d",
dfs->dfs_ignore_dfs ? 1:0);
break;
default:
error = -EINVAL;
break;
}
dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
goto bad;
}

View file

@ -230,313 +230,3 @@ void dfs_stacac_stop(struct wlan_dfs *dfs)
"Stopping STA CAC Timer %d procphyerr 0x%08x",
dfs->dfs_curchan->dfs_ch_freq, phyerr);
}
int dfs_random_channel(struct wlan_dfs *dfs,
uint8_t is_select_nondfs,
uint8_t skip_curchan)
{
int chanStart, n = 0;
uint64_t curChanFlags = 0, chan_flags;
uint16_t chan_flagext = 0;
int numGChannels = 0;
int numAChannels = 0;
int j = 0;
int ht160_count = 0;
int ht80_80_count = 0;
int ht80_count = 0;
int ht40plus_count = 0;
int ht40minus_count = 0;
int ht20_count = 0;
int use_lower_5g_only = 0;
int use_upper_5g_only = 0;
/*
* IR: 107025 -- Random channel selction not correct instead
* of uint8_t available_chan_idx[IEEE80211_CHAN_MAX+1] use
* int *available_chan_idx and dynamically allocate it
* storing int charStart in byte array available_chan_idx[]
* is reason for random channel selection failure when
* number of max channel (IEEE80211_CHAN_MAX) is more than 255.
*/
int *available_chan_idx;
int available_chan_count = 0;
int ret_val = -1;
uint32_t alt_chan_mode = 0;
int chan_count = 0;
struct dfs_ieee80211_channel *c = NULL, lc;
int nchans = 0;
uint8_t no_wradar = 0;
c = &lc;
available_chan_idx = qdf_mem_malloc(
(IEEE80211_CHAN_MAX + 1) * sizeof(int));
if (!(available_chan_idx)) {
dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "cannot allocate memory");
return ret_val;
}
/*
* FR 27305: In Japan domain, if current channel is below
* channel 100 then find a new channel that is below 100.
* Similarly if the current channel is 100 or higher then
* pick a channel that is 100 or higher.
*/
if (utils_get_dfsdomain(dfs->dfs_pdev_obj) == DFS_MKK4_DOMAIN) {
if (IEEE80211_IS_CHAN_11AC_VHT80_80(dfs->dfs_curchan)) {
/* No action required for now. */
use_lower_5g_only = 0;
use_upper_5g_only = 0;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"-- MMK4 domain, HT80_80, no restriction on using upper or lower 5G channel"
);
} else if (IEEE80211_IS_CHAN_11AC_VHT160(dfs->dfs_curchan)) {
/* No action required for now. */
use_lower_5g_only = 0;
use_upper_5g_only = 0;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"-- MMK4 domain, HT160, will look for HT160. if can't find no restriction on using upper or lower 5G channel"
);
} else {
if (dfs->dfs_curchan->dfs_ch_freq < CH100_START_FREQ) {
use_lower_5g_only = 1;
use_upper_5g_only = 0;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"-- MMK4 domain, search for lower 5G (less than 5490 MHz) channels"
);
} else {
use_lower_5g_only = 0;
use_upper_5g_only = 1;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"-- MMK4 domain, search for upper 5G (more than 5490 MHz) channels"
);
}
}
}
/*
* Pick a random channel.
* Find how many G channels are present in the channel list.
* Assuming all G channels are present at the beginning of the
* list, followed by all A channels
*/
dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans);
for (j = 0; j < nchans; j++) {
dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj,
&(c->dfs_ch_freq),
&(c->dfs_ch_flags),
&(c->dfs_ch_flagext),
&(c->dfs_ch_ieee),
&(c->dfs_ch_vhtop_ch_freq_seg1),
&(c->dfs_ch_vhtop_ch_freq_seg2),
j);
chan_flags = c->dfs_ch_flags;
if (chan_flags & IEEE80211_CHAN_2GHZ) {
numGChannels++;
continue;
} else
break;
}
numAChannels = (nchans - numGChannels);
chanStart = numGChannels;
curChanFlags = (dfs->dfs_curchan->dfs_ch_flags) & IEEE80211_CHAN_ALL;
if (dfs_mlme_dfs_ch_flags_ext(dfs->dfs_pdev_obj) &
IEEE80211_FEXT_BLKDFSCHAN)
curChanFlags &= ~IEEE80211_CHAN_DFS;
for (n = 0; n < nchans; chanStart++, n++) {
if (chanStart == nchans)
chanStart = 0;
dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj,
&(c->dfs_ch_freq),
&(c->dfs_ch_flags),
&(c->dfs_ch_flagext),
&(c->dfs_ch_ieee),
&(c->dfs_ch_vhtop_ch_freq_seg1),
&(c->dfs_ch_vhtop_ch_freq_seg2),
chanStart);
chan_flags = c->dfs_ch_flags;
chan_flagext = c->dfs_ch_flagext;
if (skip_curchan) {
/* Skip curchan when choosing apriori random channel.
*/
if (c->dfs_ch_freq == dfs->dfs_curchan->dfs_ch_freq)
continue;
}
/* These channels have CAC of 10 minutes so skipping these. */
dfs_mlme_get_dfs_ch_no_weather_radar_chan(dfs->dfs_pdev_obj,
&no_wradar);
if (no_wradar) {
/*
* We should also avoid this channel in HT40 mode as
* extension channel will be on 5600.
*/
uint32_t freq = 0;
freq = dfs_ieee80211_chan2freq(c);
if (((IS_CHANNEL_WEATHER_RADAR(freq)) ||
((IEEE80211_CHAN_11NA_HT40PLUS &
chan_flags)
&& (freq == ADJACENT_WEATHER_RADAR_CHANNEL)
)) && (DFS_ETSI_DOMAIN ==
utils_get_dfsdomain(dfs->dfs_pdev_obj)))
continue;
}
#undef ADJACENT_WEATHER_RADAR_CHANNEL
/*
* 1) Skip static turbo channel as it will require STA to be
* in static turbo to work.
* 2) Skip channel which's marked with radar detction.
* 3) WAR: We allow user to config not to use any DFS channel.
* When we pick a channel, skip excluded 11D channels.
* See bug 3124.
*/
if ((chan_flags & IEEE80211_CHAN_STURBO) ||
(chan_flags & IEEE80211_CHAN_DFS_RADAR) ||
(chan_flagext & IEEE80211_CHAN_11D_EXCLUDED) ||
(chan_flagext & IEEE80211_CHAN_DFS &&
dfs_mlme_dfs_ch_flags_ext(dfs->dfs_pdev_obj) &
IEEE80211_FEXT_BLKDFSCHAN) ||
(chan_flagext & IEEE80211_CHAN_DFS && is_select_nondfs))
continue;
/*
* FR 27305: In Japan domain, if current channel is below
* channel 100 then find a new channel that is below 100.
* Similarly if the current channel is 100 or higher then
* pick a channel that is 100 or higher.
*/
if (use_lower_5g_only) {
if (IEEE80211_IS_CHAN_11AC_VHT80_80(c)) {
if ((c->dfs_ch_freq > CH100_START_FREQ) ||
(c->dfs_ch_vhtop_ch_freq_seg2 >
CH100)) {
/* Skip this channel. */
continue;
}
} else {
if (c->dfs_ch_freq > CH100_START_FREQ) {
/* Skip this channel. */
continue;
}
}
}
if (use_upper_5g_only) {
if (IEEE80211_IS_CHAN_11AC_VHT80_80(c)) {
if ((c->dfs_ch_freq < CH100_START_FREQ) ||
(c->dfs_ch_vhtop_ch_freq_seg2 <
CH100)) {
/* Skip this channel. */
continue;
}
} else {
if (c->dfs_ch_freq < CH100_START_FREQ) {
/* Skip this channel. */
continue;
}
}
}
/*
* Keep a count of VHT160, VHT80_80 and VHT80 channels
* so that we can move from VHT160 to VHT80_80 to VHT80
* if we cannot find a channel in current mode.
*/
if (chan_flags & IEEE80211_CHAN_VHT20)
ht20_count++;
else if (chan_flags & IEEE80211_CHAN_VHT40PLUS)
ht40plus_count++;
else if (chan_flags & IEEE80211_CHAN_VHT40MINUS)
ht40minus_count++;
else if (chan_flags & IEEE80211_CHAN_VHT80)
ht80_count++;
else if (chan_flags & IEEE80211_CHAN_VHT80_80)
ht80_80_count++;
else if (chan_flags & IEEE80211_CHAN_VHT160)
ht160_count++;
if ((chan_flags & IEEE80211_CHAN_ALL) == curChanFlags) {
available_chan_idx[available_chan_count++] = chanStart;
if (available_chan_count >= IEEE80211_CHAN_MAX + 1)
break;
}
}
if (available_chan_count) {
uint32_t random_byte = 0;
get_random_bytes(&random_byte, 1);
j = (random_byte + qdf_system_ticks()) % available_chan_count;
chanStart = (available_chan_idx[j]);
ret_val = chanStart;
} else {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Cannot find a channel, looking for channel in other mode. ht80_count=%d, ht80_80_count=%d, ht160_count=%d",
ht80_count,
ht80_80_count, ht160_count);
/*
* We need to handle HT160/HT80_80 in a special way HT160
* has only two channels available. We will try to change
* to HT80_80 if we cannot find any 160 MHz contiguous
* channel. If there is no HT80_80 channel then we will
* look for HT80 channel. Also we will change HT80_80 to
* HT80 in case we can't find a HT80_80 channel. This can
* happen in some design with two 5G radios where one
* radio operates in channel 36 through 64. The same could
* be done for other 11AC modes but we have plenty of HT80,
* HT40 and HT20 channels. The following code can also
* be enhanced to switch automatically to a wider channel
* whenever one is present.
*/
if (ht160_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT160;
chan_count = ht160_count;
} else if (ht80_80_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT80_80;
chan_count = ht80_80_count;
} else if (ht80_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT80;
chan_count = ht80_count;
} else if (ht40plus_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT40PLUS;
chan_count = ht40plus_count;
} else if (ht40minus_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT40MINUS;
chan_count = ht40minus_count;
} else if (ht20_count > 0) {
alt_chan_mode = IEEE80211_CHAN_VHT20;
chan_count = ht20_count;
}
if (chan_count) {
ret_val = dfs_mlme_find_alternate_mode_channel
(dfs->dfs_pdev_obj, alt_chan_mode, chan_count);
if (ret_val == -1) {
/* Last attempt to get a valid channel. */
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Cannot find a channel. Forcing to first available HT20 channel"
);
dfs_mlme_find_any_valid_channel
(dfs->dfs_pdev_obj,
IEEE80211_CHAN_VHT20, &ret_val);
}
} else {
/*
* When all the DFS channels are in NOL and there
* is no DFS channel, chan_count is 0 and observed
* 'Division by zero in kernel'.
*/
ret_val = -1;
}
}
qdf_mem_free(available_chan_idx);
return ret_val;
}

View file

@ -30,7 +30,8 @@
#include <qdf_mc_timer.h>
/**
* dfs_populate_80mhz_available_channels()- Populate channels for 80MHz uing bitmap
* dfs_populate_80mhz_available_channels()- Populate channels for 80MHz using
* bitmap
* @bitmap: bitmap
* @avail_chnl: prepared channel list
*
@ -60,13 +61,16 @@ static uint8_t dfs_populate_80mhz_available_channels(
(DFS_NEXT_5GHZ_CHANNEL * 3);
}
}
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "channel count %d", chnl_count);
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
"channel count %d", chnl_count);
return chnl_count;
}
/**
* dfs_populate_40mhz_available_channels()- Populate channels for 40MHz uing bitmap
* dfs_populate_40mhz_available_channels()- Populate channels for 40MHz using
* bitmap
* @bitmap: bitmap
* @avail_chnl: prepared channel list
*
@ -99,13 +103,15 @@ static uint8_t dfs_populate_40mhz_available_channels(
(DFS_NEXT_5GHZ_CHANNEL * 3);
}
}
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "channel count %d", chnl_count);
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
"channel count %d", chnl_count);
return chnl_count;
}
/**
* dfs_populate_available_channels()- Populate channels based on width and bitmap
* dfs_populate_available_channels()- Populate channels based on width and
* bitmap
* @bitmap: bitmap
* @ch_width: channel width
* @avail_chnl: prepared channel list
@ -168,6 +174,7 @@ static uint8_t dfs_get_rand_from_lst(uint8_t *ch_lst, uint8_t num_ch)
/**
* dfs_random_channel_sel_set_bitmap()- Set channel bit in bitmap based
* on given channel number
* @dfs: Pointer to DFS structure.
* @bitmap: bitmap
* @channel: channel number
*
@ -176,8 +183,9 @@ static uint8_t dfs_get_rand_from_lst(uint8_t *ch_lst, uint8_t num_ch)
* Return: None
*/
static void dfs_random_channel_sel_set_bitmap(
struct chan_bonding_bitmap *bitmap,
uint8_t channel)
struct wlan_dfs *dfs,
struct chan_bonding_bitmap *bitmap,
uint8_t channel)
{
int i = 0;
int start_chan = 0;
@ -192,12 +200,13 @@ static void dfs_random_channel_sel_set_bitmap(
}
}
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"Channel=%d is not in the bitmap", channel);
}
/**
* dfs_find_ch_with_fallback()- find random channel
* @dfs: Pointer to DFS structure.
* @ch_wd: channel width
* @center_freq_seg1: center frequency of secondary segment.
* @ch_lst: list of available channels.
@ -208,10 +217,12 @@ static void dfs_random_channel_sel_set_bitmap(
*
* Return: channel number
*/
static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
uint8_t *center_freq_seg1,
uint8_t *ch_lst,
uint32_t num_ch)
static uint8_t dfs_find_ch_with_fallback(
struct wlan_dfs *dfs,
uint8_t *ch_wd,
uint8_t *center_freq_seg1,
uint8_t *ch_lst,
uint32_t num_ch)
{
bool flag = false;
uint32_t rand_byte = 0;
@ -229,9 +240,9 @@ static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
ch_map.chan_bonding_set[5].start_chan = 149;
for (i = 0; i < num_ch; i++) {
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"channel = %d added to bitmap", ch_lst[i]);
dfs_random_channel_sel_set_bitmap(&ch_map, ch_lst[i]);
dfs_random_channel_sel_set_bitmap(dfs, &ch_map, ch_lst[i]);
}
/* populate available channel list from bitmap */
@ -242,11 +253,12 @@ static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
if ((*ch_wd == DFS_CH_WIDTH_160MHZ) ||
(*ch_wd == DFS_CH_WIDTH_80P80MHZ) ||
(*ch_wd == DFS_CH_WIDTH_80MHZ)) {
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"from [%d] to 40Mhz", *ch_wd);
*ch_wd = DFS_CH_WIDTH_40MHZ;
} else if (*ch_wd == DFS_CH_WIDTH_40MHZ) {
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "from 40Mhz to 20MHz");
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"from 40Mhz to 20MHz");
*ch_wd = DFS_CH_WIDTH_20MHZ;
}
return 0;
@ -256,7 +268,7 @@ static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
if (((*ch_wd == DFS_CH_WIDTH_160MHZ) ||
(*ch_wd == DFS_CH_WIDTH_80P80MHZ)) &&
(final_cnt < DFS_MAX_20M_SUB_CH)) {
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"from [%d] to 80Mhz", *ch_wd);
*ch_wd = DFS_CH_WIDTH_80MHZ;
return 0;
@ -285,7 +297,7 @@ static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
}
if ((flag == false) && (*ch_wd > DFS_CH_WIDTH_80MHZ)) {
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"from [%d] to 80Mhz", *ch_wd);
*ch_wd = DFS_CH_WIDTH_80MHZ;
return 0;
@ -327,12 +339,12 @@ static uint8_t dfs_find_ch_with_fallback(uint8_t *ch_wd,
*ch_wd = DFS_CH_WIDTH_80MHZ;
*center_freq_seg1 = sec_seg_ch;
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Center frequency seg1 = %d", sec_seg_ch);
} else {
target_channel = dfs_get_rand_from_lst(final_lst, final_cnt);
}
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"target channel = %d", target_channel);
return target_channel;
@ -380,7 +392,7 @@ static bool dfs_freq_is_in_nol(struct wlan_dfs *dfs, uint32_t freq)
nol = dfs->dfs_nol;
while (nol) {
if (freq == nol->nol_freq) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"%d is in nol", freq);
return true;
}
@ -415,7 +427,7 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
struct dfs_acs_info *acs_info)
{
struct dfs_ieee80211_channel *chan;
uint16_t flag_no_wheather = 0;
uint16_t flag_no_weather = 0;
uint16_t flag_no_lower_5g = 0;
uint16_t flag_no_upper_5g = 0;
uint16_t flag_no_dfs_chan = 0;
@ -423,8 +435,8 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
uint16_t flag_no_5g_chan = 0;
int i;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "flags %d", flags);
flag_no_wheather = (dfs_region == DFS_ETSI_REGION_VAL) ?
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, "flags %d", flags);
flag_no_weather = (dfs_region == DFS_ETSI_REGION_VAL) ?
flags & DFS_RANDOM_CH_FLAG_NO_WEATHER_CH : 0;
flag_no_lower_5g = (dfs_region == DFS_MKK_REGION_VAL) ?
@ -442,15 +454,27 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
if ((chan->dfs_ch_ieee == 0) ||
(chan->dfs_ch_ieee > MAX_CHANNEL_NUM)) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "invalid channel %d",
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"invalid channel %d",
chan->dfs_ch_ieee);
continue;
}
if (flags & DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH) {
/* TODO : Skip all HT20 channels in the given mode */
if (chan->dfs_ch_ieee ==
dfs->dfs_curchan->dfs_ch_ieee) {
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip %d current operating channel\n",
chan->dfs_ch_ieee);
continue;
}
}
if (acs_info && (acs_info->acs_mode == 1) &&
((chan->dfs_ch_ieee < acs_info->start_ch) ||
(chan->dfs_ch_ieee > acs_info->end_ch))) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip ch %d not in acs range (%d-%d)",
chan->dfs_ch_ieee, acs_info->start_ch,
acs_info->end_ch);
@ -460,7 +484,7 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
if (flag_no_2g_chan &&
chan->dfs_ch_ieee <= DFS_MAX_24GHZ_CHANNEL) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip 2.4 GHz channel=%d",
chan->dfs_ch_ieee);
continue;
@ -468,59 +492,48 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
if (flag_no_5g_chan &&
chan->dfs_ch_ieee > DFS_MAX_24GHZ_CHANNEL) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip 5 GHz channel=%d",
chan->dfs_ch_ieee);
continue;
}
if (flag_no_wheather) {
/*
* We should also avoid this channel in HT40 mode as
* extension channel will be on 5600.
*/
/* TODO check if reg updating chan->dfs_ch_flags for
* IEEE80211_CHAN_11NA_HT40PLUS
*/
if (flag_no_weather) {
if (DFS_IS_CHANNEL_WEATHER_RADAR(chan->dfs_ch_freq)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip weather channel=%d",
chan->dfs_ch_ieee);
continue;
} else if (DFS_ADJACENT_WEATHER_RADAR_CHANNEL ==
chan->dfs_ch_freq && (chan->dfs_ch_flags &
IEEE80211_CHAN_11NA_HT40PLUS)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
"skip weather adjacent ch=%d",
chan->dfs_ch_ieee);
continue;
}
}
if (flag_no_lower_5g &&
DFS_IS_CHAN_JAPAN_INDOOR(chan->dfs_ch_freq)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
DFS_IS_CHAN_JAPAN_INDOOR(chan->dfs_ch_ieee)) {
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip indoor channel=%d",
chan->dfs_ch_ieee);
continue;
}
if (flag_no_upper_5g &&
DFS_IS_CHAN_JAPAN_OUTDOOR(chan->dfs_ch_freq)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "skip outdoor channel=%d",
DFS_IS_CHAN_JAPAN_OUTDOOR(chan->dfs_ch_ieee)) {
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip outdoor channel=%d",
chan->dfs_ch_ieee);
continue;
}
if (flag_no_dfs_chan &&
(chan->dfs_ch_flagext & IEEE80211_CHAN_DFS)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "skip dfs channel=%d",
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip dfs channel=%d",
chan->dfs_ch_ieee);
continue;
}
if (dfs_freq_is_in_nol(dfs, chan->dfs_ch_freq)) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "skip nol channel=%d",
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip nol channel=%d",
chan->dfs_ch_ieee);
continue;
}
@ -542,6 +555,7 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs,
uint8_t target_ch = 0;
uint8_t *random_chan_list = NULL;
uint32_t random_chan_cnt = 0;
uint16_t flag_no_weather = 0;
if (!ch_list || !ch_cnt) {
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
@ -569,6 +583,9 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs,
dfs_apply_rules(dfs, flags, random_chan_list, &random_chan_cnt,
ch_list, ch_cnt, dfs_region, acs_info);
flag_no_weather = (dfs_region == DFS_ETSI_REGION_VAL) ?
flags & DFS_RANDOM_CH_FLAG_NO_WEATHER_CH : 0;
do {
if (*ch_wd == DFS_CH_WIDTH_20MHZ) {
target_ch = dfs_get_rand_from_lst(
@ -576,10 +593,26 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs,
break;
}
target_ch = dfs_find_ch_with_fallback(ch_wd,
target_ch = dfs_find_ch_with_fallback(dfs, ch_wd,
&cur_chan->dfs_ch_vhtop_ch_freq_seg2,
random_chan_list,
random_chan_cnt);
/*
* When flag_no_weather is set, avoid usage of Adjacent
* weather radar channel in HT40 mode as extension channel
* will be on 5600.
*/
if (flag_no_weather &&
(target_ch ==
DFS_ADJACENT_WEATHER_RADAR_CHANNEL_NUM) &&
(*ch_wd == DFS_CH_WIDTH_40MHZ)) {
dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"skip weather adjacent ch=%d\n",
target_ch);
continue;
}
if (target_ch)
break;
} while (true);

View file

@ -97,35 +97,6 @@ void dfs_mlme_deliver_event_up_afrer_cac(struct wlan_objmgr_pdev *pdev);
*/
void dfs_mlme_get_dfs_ch_nchans(struct wlan_objmgr_pdev *pdev, int *nchans);
/**
* dfs_mlme_get_dfs_ch_no_weather_radar_chan() - Checks is the channel is
* weather radar channel.
* @pdev: Pointer to DFS pdev object.
* @no_wradar: Pointer to save weather radar filter value.
*/
void dfs_mlme_get_dfs_ch_no_weather_radar_chan(struct wlan_objmgr_pdev *pdev,
uint8_t *no_wradar);
/**
* dfs_mlme_find_alternate_mode_channel() - Finds the channel.
* @pdev: Pointer to DFS pdev object.
* @alt_chan_mode: Input mode.
* @chan_count: channel count.
*/
int dfs_mlme_find_alternate_mode_channel(struct wlan_objmgr_pdev *pdev,
uint32_t alt_chan_mode,
int chan_count);
/**
* dfs_mlme_find_any_valid_channel() - Finds the channel with the given mode.
* @pdev: Pointer to DFS pdev object.
* @chan_mode: Channel mode.
* @ret_val: Pointer to save the channel index.
*/
void dfs_mlme_find_any_valid_channel(struct wlan_objmgr_pdev *pdev,
uint32_t chan_mode,
int *ret_val);
/**
* dfs_mlme_get_extchan() - Get extension channel.
* @pdev: Pointer to DFS pdev object.

View file

@ -42,10 +42,6 @@
* space
* @mlme_get_dfs_ch_nchans: Get number of channels in the channel
* list.
* @mlme_get_dfs_ch_no_weather_radar_chan: Checks is the channel is weather
* radar channel.
* @mlme_find_alternate_mode_channel: Finds the channel.
* @mlme_find_any_valid_channel: Find the valid channeil.
* @mlme_get_extchan: Gets the extension channel.
* @mlme_set_no_chans_available: Sets no_chans_available flag.
* @mlme_ieee2mhz: Gets Channel freq from ieee number.
@ -86,18 +82,6 @@ struct dfs_to_mlme {
struct wlan_objmgr_pdev *pdev);
QDF_STATUS (*mlme_get_dfs_ch_nchans)(struct wlan_objmgr_pdev *pdev,
int *nchans);
QDF_STATUS (*mlme_get_dfs_ch_no_weather_radar_chan)(
struct wlan_objmgr_pdev *pdev,
uint8_t *no_wradar);
QDF_STATUS (*mlme_find_alternate_mode_channel)(
struct wlan_objmgr_pdev *pdev,
uint32_t alt_chan_mode,
int chan_count,
int *ret_val);
QDF_STATUS (*mlme_find_any_valid_channel)(
struct wlan_objmgr_pdev *pdev,
uint32_t chan_mode,
int *ret_val);
QDF_STATUS (*mlme_get_extchan)(struct wlan_objmgr_pdev *pdev,
uint16_t *dfs_ch_freq,
uint64_t *dfs_ch_flags,

View file

@ -168,23 +168,6 @@ QDF_STATUS utils_dfs_cac_stop(struct wlan_objmgr_pdev *pdev);
*/
QDF_STATUS utils_dfs_stacac_stop(struct wlan_objmgr_pdev *pdev);
/**
* utils_dfs_random_channel() - Function to choose the random channel from the
* current channel list.
* @pdev: Pointer to DFS pdev object.
* @is_select_nondfs: Select NON-DFS chan or both NON-DFS and DFS.
* @skip_curchan: Select the next channel post radar detecr and skip the
* curchan.
* @target_channel: Pointer to target_channel.
*
* wrapper function for dfs_random_channel(). this
* function called from outside of dfs component.
*/
QDF_STATUS utils_dfs_random_channel(struct wlan_objmgr_pdev *pdev,
uint8_t is_select_nondfs,
uint8_t skip_curchan,
int *target_channel);
/**
* utils_dfs_get_usenol() - Returns use_nol flag.
* @pdev: Pointer to DFS pdev object.

View file

@ -65,12 +65,6 @@ void register_dfs_callbacks(void)
tmp_dfs_to_mlme->mlme_deliver_event_up_afrer_cac =
mlme_dfs_deliver_event_up_afrer_cac;
tmp_dfs_to_mlme->mlme_get_dfs_ch_nchans = mlme_dfs_get_dfs_ch_nchans;
tmp_dfs_to_mlme->mlme_get_dfs_ch_no_weather_radar_chan =
mlme_dfs_get_dfs_ch_no_weather_radar_chan;
tmp_dfs_to_mlme->mlme_find_alternate_mode_channel =
mlme_dfs_find_alternate_mode_channel;
tmp_dfs_to_mlme->mlme_find_any_valid_channel =
mlme_dfs_find_any_valid_channel;
tmp_dfs_to_mlme->mlme_get_extchan = mlme_dfs_get_extchan;
tmp_dfs_to_mlme->mlme_set_no_chans_available =
mlme_dfs_set_no_chans_available;

View file

@ -141,40 +141,6 @@ void dfs_mlme_get_dfs_ch_nchans(struct wlan_objmgr_pdev *pdev,
nchans);
}
void dfs_mlme_get_dfs_ch_no_weather_radar_chan(struct wlan_objmgr_pdev *pdev,
uint8_t *no_wradar)
{
if (global_dfs_to_mlme.mlme_get_dfs_ch_no_weather_radar_chan != NULL)
global_dfs_to_mlme.mlme_get_dfs_ch_no_weather_radar_chan(
pdev,
no_wradar);
}
int dfs_mlme_find_alternate_mode_channel(struct wlan_objmgr_pdev *pdev,
uint32_t alt_chan_mode,
int chan_count)
{
int ret_val = 0;
if (global_dfs_to_mlme.mlme_find_alternate_mode_channel != NULL)
global_dfs_to_mlme.mlme_find_alternate_mode_channel(
pdev,
alt_chan_mode, chan_count, &ret_val);
return ret_val;
}
void dfs_mlme_find_any_valid_channel(struct wlan_objmgr_pdev *pdev,
uint32_t chan_mode,
int *ret_val)
{
if (global_dfs_to_mlme.mlme_find_any_valid_channel != NULL)
global_dfs_to_mlme.mlme_find_any_valid_channel(
pdev,
chan_mode,
ret_val);
}
QDF_STATUS dfs_mlme_get_extchan(struct wlan_objmgr_pdev *pdev,
uint16_t *dfs_ch_freq,
uint64_t *dfs_ch_flags,

View file

@ -219,7 +219,7 @@ QDF_STATUS tgt_dfs_process_radar_ind(struct wlan_objmgr_pdev *pdev,
struct wlan_dfs *dfs;
if (!pdev) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null pdev");
dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "null pdev");
return QDF_STATUS_E_FAILURE;
}

View file

@ -24,6 +24,7 @@
#include "wlan_dfs_utils_api.h"
#include "../../core/src/dfs.h"
#include "../../core/src/dfs_zero_cac.h"
#include <wlan_reg_services_api.h>
#include "../../core/src/dfs_random_chan_sel.h"
#ifdef QCA_DFS_USE_POLICY_MANAGER
#include "wlan_policy_mgr_api.h"
@ -166,25 +167,6 @@ QDF_STATUS utils_dfs_stacac_stop(struct wlan_objmgr_pdev *pdev)
}
EXPORT_SYMBOL(utils_dfs_stacac_stop);
QDF_STATUS utils_dfs_random_channel(struct wlan_objmgr_pdev *pdev,
uint8_t is_select_nondfs,
uint8_t skip_curchan,
int *target_channel)
{
struct wlan_dfs *dfs;
dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev);
if (!dfs)
return QDF_STATUS_E_FAILURE;
*target_channel = dfs_random_channel(dfs,
is_select_nondfs,
skip_curchan);
return QDF_STATUS_SUCCESS;
}
EXPORT_SYMBOL(utils_dfs_random_channel);
QDF_STATUS utils_dfs_get_usenol(struct wlan_objmgr_pdev *pdev, uint16_t *usenol)
{
struct wlan_dfs *dfs;
@ -421,6 +403,13 @@ static void utils_dfs_get_max_sup_width(struct wlan_objmgr_pdev *pdev,
return;
}
/**
* utils_dfs_get_chan_list() - Get channel list from regdb based on current
* operating channel.
* @pdev: Pointer to DFS pdev object.
* @chan_list: Pointer to current channel list
* @num_chan: number of channels in the current channel list.
*/
#ifndef QCA_DFS_USE_POLICY_MANAGER
static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
struct dfs_ieee80211_channel *chan_list, uint32_t *num_chan)
@ -436,8 +425,11 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
cur_chan_list = qdf_mem_malloc(NUM_CHANNELS *
sizeof(struct regulatory_channel));
if (cur_chan_list == NULL)
if (!cur_chan_list) {
dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "fail to alloc");
*num_chan = 0;
return;
}
if (wlan_reg_get_current_chan_list(
pdev, cur_chan_list) != QDF_STATUS_SUCCESS) {
@ -450,9 +442,12 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
for (i = 0; i < NUM_CHANNELS; i++) {
state = cur_chan_list[i].state;
if (state == CHANNEL_STATE_DFS ||
state == CHANNEL_STATE_ENABLE) {
state == CHANNEL_STATE_ENABLE) {
chan_list[j].dfs_ch_ieee = cur_chan_list[i].chan_num;
chan_list[j].dfs_ch_freq = cur_chan_list[i].center_freq;
if (state == CHANNEL_STATE_DFS)
chan_list[j].dfs_ch_flagext =
IEEE80211_CHAN_DFS;
j++;
}
}
@ -461,7 +456,82 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
return;
}
/**
* utils_dfs_get_channel_list() - Get channel list from regdb component based
* on current channel list.
* @pdev: Pointer to pdev structure.
* @chan_list: Pointer to regdb channel list.
* @num_chan: number of channels.
*
* Get regdb channel list based on dfs current channel.
* ex: When AP is operating in 5GHz channel, filter 2.4GHz and 4.9GHZ channels
* so that the random channel function does not select either 2.4GHz or 4.9GHz
* channel.
*/
static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
struct dfs_ieee80211_channel *chan_list, uint32_t *num_chan)
{
struct dfs_ieee80211_channel *tmp_chan_list = NULL;
struct wlan_dfs *dfs;
bool is_curchan_5g;
bool is_curchan_24g;
bool is_curchan_49g;
uint32_t chan_num;
uint32_t center_freq;
uint16_t flagext;
int i, j = 0;
dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev);
if (!dfs) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null dfs");
return;
}
tmp_chan_list = qdf_mem_malloc(*num_chan * sizeof(*tmp_chan_list));
if (!tmp_chan_list) {
dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "mem alloc failed");
return;
}
utils_dfs_get_chan_list(pdev, tmp_chan_list, num_chan);
chan_num = dfs->dfs_curchan->dfs_ch_ieee;
center_freq = dfs->dfs_curchan->dfs_ch_freq;
is_curchan_5g = WLAN_REG_IS_5GHZ_CH(chan_num);
is_curchan_24g = WLAN_REG_IS_24GHZ_CH(chan_num);
is_curchan_49g = WLAN_REG_IS_49GHZ_FREQ(center_freq);
for (i = 0; i < *num_chan; i++) {
chan_num = tmp_chan_list[i].dfs_ch_ieee;
center_freq = tmp_chan_list[i].dfs_ch_freq;
flagext = tmp_chan_list[i].dfs_ch_flagext;
if ((is_curchan_5g) && WLAN_REG_IS_5GHZ_CH(chan_num)) {
chan_list[j].dfs_ch_ieee = chan_num;
chan_list[j].dfs_ch_freq = center_freq;
chan_list[j].dfs_ch_flagext = flagext;
j++;
} else if ((is_curchan_24g) &&
WLAN_REG_IS_24GHZ_CH(chan_num)) {
chan_list[j].dfs_ch_ieee = chan_num;
chan_list[j].dfs_ch_freq = center_freq;
j++;
} else if ((is_curchan_49g) &&
WLAN_REG_IS_49GHZ_FREQ(center_freq)) {
chan_list[j].dfs_ch_ieee = chan_num;
chan_list[j].dfs_ch_freq = center_freq;
j++;
}
}
*num_chan = j;
qdf_mem_free(tmp_chan_list);
}
#else
static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
struct dfs_ieee80211_channel *chan_list, uint32_t *num_chan)
{
@ -507,6 +577,19 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
*num_chan = i;
dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "num channels %d", i);
}
/**
* utils_dfs_get_channel_list() - Wrapper function to get channel list from
* regdb component.
* @pdev: Pointer to pdev structure.
* @chan_list: Pointer to regdb channel list.
* @num_chan: number of channels.
*/
static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
struct dfs_ieee80211_channel *chan_list, uint32_t *num_chan)
{
utils_dfs_get_chan_list(pdev, chan_list, num_chan);
}
#endif
QDF_STATUS utils_dfs_get_random_channel(
@ -545,7 +628,7 @@ QDF_STATUS utils_dfs_get_random_channel(
goto random_chan_error;
}
utils_dfs_get_chan_list(pdev, chan_list, &num_chan);
utils_dfs_get_channel_list(pdev, chan_list, &num_chan);
if (!num_chan) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "zero channels");
goto random_chan_error;

View file

@ -4028,5 +4028,10 @@ bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev)
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
reg_err("pdev reg component is NULL");
return false;
}
return pdev_priv_obj->en_chan_144;
}