Merge "qca-wifi: Remove references to CHAN_NUM_API"
diff --git a/umac/dfs/core/src/misc/dfs_zero_cac.c b/umac/dfs/core/src/misc/dfs_zero_cac.c
index 6477e47..f15073a 100644
--- a/umac/dfs/core/src/misc/dfs_zero_cac.c
+++ b/umac/dfs/core/src/misc/dfs_zero_cac.c
@@ -261,34 +261,17 @@
/* Given a bandwidth, find the number of subchannels in that bandwidth */
#define N_SUBCHS_FOR_BANDWIDTH(_bw) ((_bw) / MIN_DFS_SUBCHAN_BW)
-#ifdef CONFIG_CHAN_FREQ_API
#define DFS_160MHZ_SECSEG_CHAN_OFFSET 40
-#else
-#ifdef CONFIG_CHAN_NUM_API
-#define DFS_160MHZ_SECSEG_CHAN_OFFSET 8
-#endif
-#endif
/*dfs_zero_cac_reset() - Reset zero cac variables.
*@dfs: Pointer to wlan_dfs
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_zero_cac_reset(struct wlan_dfs *dfs)
{
dfs->dfs_precac_timeout_override = -1;
dfs->dfs_precac_primary_freq_mhz = 0;
dfs->dfs_precac_secondary_freq_mhz = 0;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_zero_cac_reset(struct wlan_dfs *dfs)
-{
- dfs->dfs_precac_timeout_override = -1;
- dfs->dfs_precac_primary_freq = 0;
- dfs->dfs_precac_secondary_freq = 0;
-}
-#endif
-#endif
void dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj *dfs_soc_obj)
{
@@ -330,30 +313,6 @@
}
#endif
-/* dfs_descend_precac_tree() - Descend into the precac BSTree based on the
- * channel provided. If the channel is less than
- * given node's channel, descend left, else right.
- * @node: Precac BSTree node.
- * @channel: Channel whose node is to be found.
- *
- * Return: the next precac_tree_node (left child or right child of
- * current node).
- */
-#ifdef CONFIG_CHAN_NUM_API
-static struct precac_tree_node *
-dfs_descend_precac_tree(struct precac_tree_node *node,
- uint8_t channel)
-{
- if (!node)
- return NULL;
-
- if (channel < node->ch_ieee)
- return node->left_child;
- else
- return node->right_child;
-}
-#endif
-
/* dfs_descend_precac_tree_for_freq() - Descend into the precac BSTree based on
* the channel provided. If the channel is less than
* given node's channel, descend left, else right.
@@ -364,7 +323,6 @@
* current node).
*/
-#ifdef CONFIG_CHAN_FREQ_API
static struct precac_tree_node *
dfs_descend_precac_tree_for_freq(struct precac_tree_node *node,
uint16_t chan_freq)
@@ -377,42 +335,6 @@
else
return node->right_child;
}
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_find_chwidth_and_center_chan(struct wlan_dfs *dfs,
- enum phy_ch_width *chwidth,
- uint8_t *primary_chan_ieee,
- uint8_t *secondary_chan_ieee)
-{
- struct dfs_channel *curchan = dfs->dfs_curchan;
-
- if (!curchan) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "curchan is NULL");
- return;
- }
-
- if (primary_chan_ieee)
- *primary_chan_ieee = curchan->dfs_ch_vhtop_ch_freq_seg1;
- if (WLAN_IS_CHAN_MODE_20(curchan)) {
- *chwidth = CH_WIDTH_20MHZ;
- } else if (WLAN_IS_CHAN_MODE_40(curchan)) {
- *chwidth = CH_WIDTH_40MHZ;
- } else if (WLAN_IS_CHAN_MODE_80(curchan)) {
- *chwidth = CH_WIDTH_80MHZ;
- } else if (WLAN_IS_CHAN_MODE_80_80(curchan)) {
- *chwidth = CH_WIDTH_80P80MHZ;
- if (secondary_chan_ieee)
- *secondary_chan_ieee =
- curchan->dfs_ch_vhtop_ch_freq_seg2;
- } else if (WLAN_IS_CHAN_MODE_160(curchan)) {
- *chwidth = CH_WIDTH_160MHZ;
- if (primary_chan_ieee)
- *primary_chan_ieee =
- curchan->dfs_ch_vhtop_ch_freq_seg2;
- }
-}
-#endif
/* dfs_find_curchwidth_and_center_chan_for_freq() - Find channel width and
* center channelfrequency.
@@ -421,7 +343,6 @@
* @primary_chan_freq: Pointer to primary channel.
* @secondary_chan_freq: Pointer to secondary channel.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void
dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs,
enum phy_ch_width *chwidth,
@@ -455,44 +376,6 @@
curchan->dfs_ch_mhz_freq_seg2;
}
}
-#endif
-
-/* dfs_find_cac_status_for_chan() - Find CAC-done status for the channel in the
- * precac Binary Search Tree (BSTree).
- * Return true if CAC done, else false.
- * @dfs_precac_entry: Precac entry which has the root of the precac BSTree.
- * @chan_ieee: IEEE channel. This ieee channel is the center of a
- * 20/40/80 MHz channel and the center channel is unique
- * irrespective of the bandwidth(20/40/80 MHz).
- *
- * Note: For each tree node of a level, the number of CACed subchannels is
- * the total number of leaf nodes of the sub tree for the node, which are
- * CACed.
- * That is, at a level (1..n, n being the depth of the BSTree), the maximum
- * number of CACed subchannels is: Number of subchannels of root / level.
- * Num_subchannels = Num_subchannels_of_root_level / level.
- *
- * Return: true if CAC done on channel, else false.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static bool dfs_find_cac_status_for_chan(struct dfs_precac_entry *precac_entry,
- uint8_t chan_ieee)
-{
- struct precac_tree_node *node = precac_entry->tree_root;
- uint8_t n_cur_lvl_subchs = N_SUBCHANS_FOR_80BW;
-
- while (node) {
- if (node->ch_ieee == chan_ieee)
- return (node->n_caced_subchs == n_cur_lvl_subchs) ?
- true : false;
-
- n_cur_lvl_subchs /= 2;
- node = dfs_descend_precac_tree(node, chan_ieee);
- }
-
- return false;
-}
-#endif
/* dfs_find_cac_status_for_chan_for_freq() - Find CAC-done status for the
* channel in the precac Binary Search Tree.
@@ -503,7 +386,6 @@
* unique irrespective of the bandwidth
* (20/40/80/160/165 MHz).
*/
-#ifdef CONFIG_CHAN_FREQ_API
static bool
dfs_find_cac_status_for_chan_for_freq(struct dfs_precac_entry *precac_entry,
uint16_t chan_freq)
@@ -522,12 +404,7 @@
return false;
}
-#endif
-#ifdef CONFIG_CHAN_NUM_API
-#define VHT80_OFFSET 6
-#endif
-#ifdef CONFIG_CHAN_FREQ_API
#define VHT80_FREQ_OFFSET 30
/* For any 160MHz channel, a frequency offset of 70MHz would have been enough
* to include the right edge and left edge channels. But, the restricted 80P80
@@ -535,7 +412,6 @@
* so an offset of 75MHz is chosen.
*/
#define VHT160_FREQ_OFFSET 75
-#endif
#define IS_WITHIN_RANGE(_A, _B, _C) \
(((_A) >= ((_B)-(_C))) && ((_A) <= ((_B)+(_C))))
@@ -543,46 +419,12 @@
#define IS_WITHIN_RANGE_STRICT(_A, _B, _C) \
(((_A) > ((_B)-(_C))) && ((_A) < ((_B)+(_C))))
-#ifdef CONFIG_CHAN_NUM_API
-bool dfs_is_precac_done_on_ht20_40_80_chan(struct wlan_dfs *dfs,
- uint8_t chan)
-{
- struct dfs_precac_entry *precac_entry;
- bool ret_val = 0;
-
- /*
- * A is within B-C and B+C
- * (B-C) <= A <= (B+C)
- */
- PRECAC_LIST_LOCK(dfs);
- if (!TAILQ_EMPTY(&dfs->dfs_precac_list))
- TAILQ_FOREACH(precac_entry,
- &dfs->dfs_precac_list,
- pe_list) {
- /* Find if the VHT80 ieee_chan is in this precac_list */
- if (IS_WITHIN_RANGE(chan, precac_entry->vht80_ch_ieee,
- VHT80_OFFSET)) {
- ret_val = dfs_find_cac_status_for_chan(
- precac_entry, chan);
- break;
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
-
- dfs_debug(dfs, WLAN_DEBUG_DFS, "ch_ieee = %u cac_done = %d",
- chan, ret_val);
-
- return ret_val;
-}
-#endif
-
/*
* dfs_is_precac_done_on_ht20_40_80_chan_for_freq() - Find if preCAC is done
* for the given frequency.
* @dfs: Pointer to wlan_dfs.
* @chan_freq: Channel frequency in MHZ.
*/
-#ifdef CONFIG_CHAN_FREQ_API
bool
dfs_is_precac_done_on_ht20_40_80_160_165_chan_for_freq(struct wlan_dfs *dfs,
uint16_t chan_freq)
@@ -617,7 +459,6 @@
return ret_val;
}
-#endif
/*
* dfs_is_precac_done_on_ht8080_chan - Find if preCAC is done
@@ -625,7 +466,6 @@
* @dfs: Pointer to wlan_dfs.
* @chan: Pointer to dfs_channel.
*/
-#ifdef CONFIG_CHAN_FREQ_API
bool dfs_is_precac_done_on_ht8080_chan(struct wlan_dfs *dfs,
struct dfs_channel *chan)
{
@@ -663,56 +503,12 @@
return ret_val;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-bool dfs_is_precac_done_on_ht8080_ht160_chan(struct wlan_dfs *dfs,
- struct dfs_channel *chan)
-{
- bool ret_val = 0, primary_found = 0;
- u_int8_t pri_chan, sec_chan = 0;
-
- pri_chan = chan->dfs_ch_vhtop_ch_freq_seg1;
- if (WLAN_IS_CHAN_MODE_160(chan)) {
- if (chan->dfs_ch_ieee < chan->dfs_ch_vhtop_ch_freq_seg2)
- sec_chan = chan->dfs_ch_vhtop_ch_freq_seg1 +
- VHT160_IEEE_FREQ_DIFF;
- else
- sec_chan = chan->dfs_ch_vhtop_ch_freq_seg1 -
- VHT160_IEEE_FREQ_DIFF;
- } else
- sec_chan = chan->dfs_ch_vhtop_ch_freq_seg2;
-
- /* Check if primary is DFS then search */
- if (WLAN_IS_CHAN_DFS(chan))
- primary_found = dfs_is_precac_done_on_ht20_40_80_chan(dfs,
- pri_chan);
- else
- primary_found = 1;
-
- /* Check if secondary DFS then search */
- if (WLAN_IS_CHAN_DFS_CFREQ2(chan) && primary_found) {
- ret_val = dfs_is_precac_done_on_ht20_40_80_chan(dfs, sec_chan);
- } else {
- if (primary_found)
- ret_val = 1;
- }
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "seg1_ieee = %u seg2_ieee = %u ret_val = %d",
- pri_chan,
- sec_chan,
- ret_val);
-
- return ret_val;
-}
-#endif
-#endif
/*
* dfs_is_precac_done() - Verify if preCAC is done.
* @dfs: Pointer to wlan_dfs.
* @chan: Pointer to dfs_channel.
*/
-#ifdef CONFIG_CHAN_FREQ_API
bool dfs_is_precac_done(struct wlan_dfs *dfs, struct dfs_channel *chan)
{
bool ret_val = 0;
@@ -744,28 +540,6 @@
dfs_debug(dfs, WLAN_DEBUG_DFS, "precac_done_status = %d", ret_val);
return ret_val;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-bool dfs_is_precac_done(struct wlan_dfs *dfs, struct dfs_channel *chan)
-{
- bool ret_val = 0;
- uint8_t pri_chan = chan->dfs_ch_vhtop_ch_freq_seg1;
-
- if (WLAN_IS_CHAN_MODE_20(chan) ||
- WLAN_IS_CHAN_MODE_40(chan) ||
- WLAN_IS_CHAN_MODE_80(chan)) {
- ret_val = dfs_is_precac_done_on_ht20_40_80_chan(dfs,
- pri_chan);
- } else if (WLAN_IS_CHAN_MODE_80_80(chan) ||
- WLAN_IS_CHAN_MODE_160(chan)) {
- ret_val = dfs_is_precac_done_on_ht8080_ht160_chan(dfs, chan);
- }
-
- dfs_debug(dfs, WLAN_DEBUG_DFS, "precac_done_status = %d", ret_val);
- return ret_val;
-}
-#endif
-#endif
#ifdef QCA_SUPPORT_AGILE_DFS
void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev,
@@ -809,7 +583,6 @@
* dfs_prepare_agile_precac_chan() - Prepare an agile channel for preCAC.
* @dfs: Pointer to wlan_dfs.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs)
{
struct wlan_objmgr_psoc *psoc;
@@ -883,107 +656,6 @@
qdf_info("No channels in preCAC required list");
}
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs)
-{
- struct wlan_objmgr_psoc *psoc;
- struct wlan_objmgr_pdev *pdev;
- struct wlan_dfs *temp_dfs;
- struct dfs_soc_priv_obj *dfs_soc_obj;
- struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
- uint8_t ch_freq = 0;
- uint8_t cur_dfs_idx = 0;
- uint8_t vhtop_ch_freq_seg1, vhtop_ch_freq_seg2;
- int i;
- struct dfs_agile_cac_params adfs_param;
-
- psoc = wlan_pdev_get_psoc(dfs->dfs_pdev_obj);
- dfs_soc_obj = dfs->dfs_soc_obj;
-
- dfs_tx_ops = wlan_psoc_get_dfs_txops(psoc);
-
- pdev = dfs->dfs_pdev_obj;
-
- for (i = 0; i < dfs_soc_obj->num_dfs_privs; i++) {
- dfs_find_pdev_for_agile_precac(pdev, &cur_dfs_idx);
- dfs_soc_obj->cur_precac_dfs_index = cur_dfs_idx;
- temp_dfs = dfs_soc_obj->dfs_priv[cur_dfs_idx].dfs;
- pdev = temp_dfs->dfs_pdev_obj;
- if (!dfs_soc_obj->dfs_priv[cur_dfs_idx].agile_precac_active)
- continue;
-
- vhtop_ch_freq_seg1 =
- temp_dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg1;
- vhtop_ch_freq_seg2 =
- temp_dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg2;
- if (WLAN_IS_CHAN_MODE_160(temp_dfs->dfs_curchan)) {
- if (vhtop_ch_freq_seg2 < vhtop_ch_freq_seg1)
- vhtop_ch_freq_seg2 -=
- DFS_160MHZ_SECSEG_CHAN_OFFSET;
- else
- vhtop_ch_freq_seg2 +=
- DFS_160MHZ_SECSEG_CHAN_OFFSET;
- }
- dfs_get_ieeechan_for_agilecac(temp_dfs,
- &ch_freq,
- vhtop_ch_freq_seg1,
- vhtop_ch_freq_seg2);
-
- if (!ch_freq) {
- qdf_info(" %s : %d No preCAC required channels left in current pdev: %pK",
- __func__, __LINE__, pdev);
- continue;
- } else {
- break;
- }
- }
-
- if (ch_freq) {
- adfs_param.precac_chan = ch_freq;
- adfs_param.precac_chwidth = temp_dfs->dfs_precac_chwidth;
- dfs_start_agile_precac_timer(temp_dfs,
- dfs->dfs_soc_obj->ocac_status,
- &adfs_param);
- qdf_info("%s : %d ADFS channel set request sent for pdev: %pK ch_freq: %d",
- __func__, __LINE__, pdev, ch_freq);
- if (dfs_tx_ops && dfs_tx_ops->dfs_agile_ch_cfg_cmd)
- dfs_tx_ops->dfs_agile_ch_cfg_cmd(pdev, &adfs_param);
- else
- dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS,
- "dfs_tx_ops=%pK", dfs_tx_ops);
- } else {
- dfs->dfs_soc_obj->precac_state_started = false;
- qdf_info("No channels in preCAC required list");
- }
-}
-#endif
-#endif
-#endif
-
-/* dfs_is_tree_node_marked_as_cac() - Check if preCAC BSTree node is
- * marked as CAC.
- * @root: Pointer to root node of the preCAC BSTree.
- * @channel: 20MHz channel to be checked if marked as CAC done already.
- *
- * Return: True if already marked, else false.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static bool
-dfs_is_tree_node_marked_as_cac(struct precac_tree_node *root,
- uint8_t channel)
-{
- struct precac_tree_node *curr_node = root;
-
- while (curr_node) {
- if (!curr_node->n_caced_subchs)
- return false;
- if (curr_node->ch_ieee == channel)
- return curr_node->n_caced_subchs;
- curr_node = dfs_descend_precac_tree(curr_node, channel);
- }
- return false;
-}
#endif
/* dfs_is_tree_node_marked_as_cac_for_freq() - Check if preCAC BSTree node is
@@ -993,7 +665,6 @@
*
* Return: True if already marked, else false.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static bool
dfs_is_tree_node_marked_as_cac_for_freq(struct precac_tree_node *root,
uint16_t freq)
@@ -1010,51 +681,6 @@
}
return false;
}
-#endif
-
-/* dfs_mark_tree_node_as_cac_done() - Mark the preCAC BSTree node as CAC done.
- * @dfs: Pointer to WLAN DFS structure.
- * @precac_entry: Precac_list entry pointer.
- * @channel: IEEE channel to be marked.
- *
- * Note: The input channel is always of 20MHz bandwidth.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static void
-dfs_mark_tree_node_as_cac_done(struct wlan_dfs *dfs,
- struct dfs_precac_entry *precac_entry,
- uint8_t channel)
-{
- struct precac_tree_node *curr_node;
-
- if (!precac_entry->tree_root) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Precac tree root pointer is NULL!");
- return;
- }
-
- curr_node = precac_entry->tree_root;
-
- /**
- * Check if the channel is already marked and return if true.
- * This will happen in scenarios like the following:
- * preCAC is running on channel 128 in HT20 mode (note: 124 is already
- * marked. Now if the mode is switched to HT40, preCAC is restarted
- * and the new channel picked for preCAC is 126 HT40. Here, 124
- * will be already marked since it was completed in HT20 mode.
- * This may happen for any mode switches (20<->40<->80 MHz).
- */
- if (dfs_is_tree_node_marked_as_cac(curr_node, channel))
- return;
-
- while (curr_node) {
- if (curr_node->n_caced_subchs <
- N_SUBCHS_FOR_BANDWIDTH(curr_node->bandwidth))
- curr_node->n_caced_subchs++;
- curr_node = dfs_descend_precac_tree(curr_node, channel);
- }
-}
-#endif
/* dfs_mark_tree_node_as_cac_done_for_freq() - Mark the preCAC BSTree node as
* CAC done.
@@ -1064,7 +690,6 @@
*
* Note: The input channel is always of 20MHz bandwidth.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static void
dfs_mark_tree_node_as_cac_done_for_freq(struct wlan_dfs *dfs,
struct dfs_precac_entry *precac_entry,
@@ -1102,31 +727,6 @@
chan_freq);
}
}
-#endif
-
-/* dfs_unmark_tree_node_as_cac_done() - Unmark the preCAC BSTree node as CAC
- * done.
- * @precac_entry: Precac_list entry pointer.
- * @channel: IEEE channel to be marked.
- *
- * Note: The input channel is always of 20MHz bandwidth.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static void
-dfs_unmark_tree_node_as_cac_done(struct dfs_precac_entry *precac_entry,
- uint8_t channel)
-{
- struct precac_tree_node *curr_node = precac_entry->tree_root;
-
- while (curr_node) {
- if (curr_node->n_caced_subchs)
- curr_node->n_caced_subchs--;
- else
- return;
- curr_node = dfs_descend_precac_tree(curr_node, channel);
- }
-}
-#endif
/* dfs_unmark_tree_node_as_cac_done_for_freq() - Unmark the preCAC BSTree
* node as CAC done.
@@ -1135,7 +735,6 @@
*
* Note: The input channel is always of 20MHz bandwidth.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static void
dfs_unmark_tree_node_as_cac_done_for_freq(struct dfs_precac_entry
*precac_entry, uint16_t chan_freq)
@@ -1151,88 +750,6 @@
chan_freq);
}
}
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_mark_precac_done(struct wlan_dfs *dfs,
- uint8_t pri_ch_ieee,
- uint8_t sec_ch_ieee,
- enum phy_ch_width ch_width)
-{
- struct dfs_precac_entry *precac_entry = NULL, *tmp_precac_entry = NULL;
- uint8_t channels[NUM_CHANNELS_160MHZ];
- uint8_t i, nchannels = 0;
-
- if (!pri_ch_ieee)
- return;
- switch (ch_width) {
- case CH_WIDTH_20MHZ:
- nchannels = 1;
- channels[0] = pri_ch_ieee;
- break;
- case CH_WIDTH_40MHZ:
- nchannels = 2;
- channels[0] = pri_ch_ieee - DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[1] = pri_ch_ieee + DFS_5GHZ_NEXT_CHAN_OFFSET;
- break;
- case CH_WIDTH_80MHZ:
- nchannels = 4;
- channels[0] = pri_ch_ieee - DFS_5GHZ_2ND_CHAN_OFFSET;
- channels[1] = pri_ch_ieee - DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[2] = pri_ch_ieee + DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[3] = pri_ch_ieee + DFS_5GHZ_2ND_CHAN_OFFSET;
- break;
- case CH_WIDTH_80P80MHZ:
- nchannels = 8;
- channels[0] = pri_ch_ieee - DFS_5GHZ_2ND_CHAN_OFFSET;
- channels[1] = pri_ch_ieee - DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[2] = pri_ch_ieee + DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[3] = pri_ch_ieee + DFS_5GHZ_2ND_CHAN_OFFSET;
- /* secondary channels */
- channels[4] = sec_ch_ieee - DFS_5GHZ_2ND_CHAN_OFFSET;
- channels[5] = sec_ch_ieee - DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[6] = sec_ch_ieee + DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[7] = sec_ch_ieee + DFS_5GHZ_2ND_CHAN_OFFSET;
- break;
- case CH_WIDTH_160MHZ:
- nchannels = 8;
- channels[0] = pri_ch_ieee - DFS_5GHZ_4TH_CHAN_OFFSET;
- channels[1] = pri_ch_ieee - DFS_5GHZ_3RD_CHAN_OFFSET;
- channels[2] = pri_ch_ieee - DFS_5GHZ_2ND_CHAN_OFFSET;
- channels[3] = pri_ch_ieee - DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[4] = pri_ch_ieee + DFS_5GHZ_NEXT_CHAN_OFFSET;
- channels[5] = pri_ch_ieee + DFS_5GHZ_2ND_CHAN_OFFSET;
- channels[6] = pri_ch_ieee + DFS_5GHZ_3RD_CHAN_OFFSET;
- channels[7] = pri_ch_ieee + DFS_5GHZ_4TH_CHAN_OFFSET;
- break;
- default:
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "invalid channel width");
- return;
- }
-
- PRECAC_LIST_LOCK(dfs);
- if (TAILQ_EMPTY(&dfs->dfs_precac_list)) {
- PRECAC_LIST_UNLOCK(dfs);
- return;
- }
- for (i = 0; i < nchannels; i++) {
- TAILQ_FOREACH_SAFE(precac_entry,
- &dfs->dfs_precac_list,
- pe_list,
- tmp_precac_entry) {
- if (IS_WITHIN_RANGE(channels[i],
- precac_entry->vht80_ch_ieee,
- VHT80_OFFSET)) {
- dfs_mark_tree_node_as_cac_done(dfs,
- precac_entry,
- channels[i]);
- break;
- }
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
-}
-#endif
/**
* dfs_find_subchannels_for_center_freq() - API to find the subchannels given
@@ -1364,7 +881,6 @@
* @sec_ch_freq: Secondary 80MHZ center frequency.
* @ch_width: Channel width.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs,
uint16_t pri_ch_freq,
uint16_t sec_ch_freq,
@@ -1405,52 +921,6 @@
}
PRECAC_LIST_UNLOCK(dfs);
}
-#endif
-
-/* dfs_mark_tree_node_as_nol() - Mark the preCAC BSTree node as NOL.
- * @dfs: Pointer to WLAN DFS structure.
- * @precac_entry: Precac_list entry pointer.
- * @channel: IEEE channel to be marked.
- *
- * Note: The input channel is always of 20MHz bandwidth.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static void
-dfs_mark_tree_node_as_nol(struct wlan_dfs *dfs,
- struct dfs_precac_entry *precac_entry,
- uint8_t channel)
-{
- struct precac_tree_node *curr_node;
-
- if (!precac_entry->tree_root) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Precac tree root pointer is NULL!");
- return;
- }
- curr_node = precac_entry->tree_root;
- while (curr_node) {
- if (curr_node->n_nol_subchs <
- N_SUBCHS_FOR_BANDWIDTH(curr_node->bandwidth)) {
- curr_node->n_nol_subchs++;
- } else {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Radarfound on an already marked NOL channel!");
- return;
- }
- if (channel == curr_node->ch_ieee) {
- if (curr_node->n_caced_subchs) {
- /* remove cac done status for this node
- * and it's parents, since this node
- * now requires cac (after NOL expiry)
- */
- dfs_unmark_tree_node_as_cac_done(precac_entry,
- channel);
- }
- }
- curr_node = dfs_descend_precac_tree(curr_node, channel);
- }
-}
-#endif
/* dfs_mark_tree_node_as_nol_for_freq() - Mark the preCAC BSTree node as NOL.
* @dfs: Pointer to WLAN DFS structure.
@@ -1459,7 +929,6 @@
*
* Note: The input channel is always of 20MHz bandwidth.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static void
dfs_mark_tree_node_as_nol_for_freq(struct wlan_dfs *dfs,
struct dfs_precac_entry *pcac,
@@ -1496,38 +965,6 @@
freq);
}
}
-#endif
-
-/* dfs_unmark_tree_node_as_nol() - Unmark the preCAC BSTree node as NOL.
- * @dfs: Pointer to WLAN DFS structure.
- * @precac_entry: Precac_list entry pointer.
- * @channel: IEEE channel to be marked.
- *
- * Note: The input channel is always of 20MHz bandwidth.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static void
-dfs_unmark_tree_node_as_nol(struct wlan_dfs *dfs,
- struct dfs_precac_entry *precac_entry,
- uint8_t channel)
-{
- struct precac_tree_node *curr_node;
-
- if (!precac_entry->tree_root) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Precac tree root pointer is NULL!");
- return;
- }
- curr_node = precac_entry->tree_root;
- while (curr_node) {
- if (curr_node->n_nol_subchs)
- curr_node->n_nol_subchs--;
- else
- return;
- curr_node = dfs_descend_precac_tree(curr_node, channel);
- }
-}
-#endif
/* dfs_unmark_tree_node_as_nol_for_freq() - Unmark the preCAC BSTree node as
* NOL.
@@ -1538,7 +975,6 @@
* Note: The input channel is always of 20MHz bandwidth.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static void
dfs_unmark_tree_node_as_nol_for_freq(struct wlan_dfs *dfs,
struct dfs_precac_entry *precac_entry,
@@ -1561,76 +997,12 @@
chan_freq);
}
}
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_unmark_precac_nol(struct wlan_dfs *dfs, uint8_t channel)
-{
- struct dfs_precac_entry *precac_entry = NULL, *tmp_precac_entry = NULL;
- uint8_t pri_ch_ieee = 0, chwidth_80 = DFS_CHWIDTH_80_VAL;
-
- PRECAC_LIST_LOCK(dfs);
- if (!TAILQ_EMPTY(&dfs->dfs_precac_list)) {
- TAILQ_FOREACH_SAFE(precac_entry, &dfs->dfs_precac_list,
- pe_list, tmp_precac_entry) {
- if (IS_WITHIN_RANGE(channel,
- precac_entry->vht80_ch_ieee,
- VHT80_OFFSET)) {
- dfs_unmark_tree_node_as_nol(dfs, precac_entry,
- channel);
- break;
- }
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
-
- /* If preCAC / agile CAC is not running, restart the timer
- * to check if the NOL expired channels can be CACed again.
- */
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "NOL expired for channel %u, trying to start preCAC",
- channel);
- if (!dfs->dfs_soc_obj->dfs_precac_timer_running) {
- if (dfs_is_legacy_precac_enabled(dfs)) {
- if (dfs_is_ap_cac_timer_running(dfs)) {
- dfs->dfs_defer_precac_channel_change = 1;
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "Primary CAC is running, deferred"
- );
- } else if (WLAN_IS_CHAN_11AC_VHT80(dfs->dfs_curchan)) {
- pri_ch_ieee = dfs->dfs_curchan->
- dfs_ch_vhtop_ch_freq_seg1;
-
- /* Check if there is a new channel to preCAC
- * and only then do vdev restart.
- */
- if (!dfs_get_ieeechan_for_precac(dfs,
- pri_ch_ieee,
- 0,
- chwidth_80))
- return;
- dfs_mlme_channel_change_by_precac(
- dfs->dfs_pdev_obj);
- }
- } else if (dfs_is_agile_precac_enabled(dfs) &&
- !dfs->dfs_soc_obj->precac_state_started) {
- /* precac_state_started will be set to false if
- * agile CAC is not begun for any channels or
- * all channels were CACed. If it's not set, defer
- * changing the current Agile CAC channel.
- */
- dfs_prepare_agile_precac_chan(dfs);
- }
- }
-}
-#endif
/*
* dfs_unmark_precac_nol_for_freq() - Unmark a channel frequency as NOL.
* @dfs: Pointer to wlan_dfs.
* @chan_freq: Channel frequency in MHZ.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, uint16_t chan_freq)
{
struct dfs_precac_entry *pcac_entry = NULL,
@@ -1690,134 +1062,6 @@
}
}
}
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_mark_precac_nol(struct wlan_dfs *dfs,
- uint8_t is_radar_found_on_secondary_seg,
- uint8_t detector_id,
- uint8_t *channels,
- uint8_t num_channels)
-{
- struct dfs_precac_entry *precac_entry = NULL, *tmp_precac_entry = NULL;
- struct wlan_objmgr_psoc *psoc;
- uint8_t i;
- struct dfs_soc_priv_obj *dfs_soc_obj;
- struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
- struct wlan_objmgr_pdev *pdev;
-
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "is_radar_found_on_secondary_seg = %u subchannel_marking = %u detector_id = %u",
- is_radar_found_on_secondary_seg,
- dfs->dfs_use_nol_subchannel_marking,
- detector_id);
-
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "agile detector ieee = %u primary_ieee = %u secondary_ieee = %u",
- dfs->dfs_agile_precac_freq,
- dfs->dfs_precac_secondary_freq,
- dfs->dfs_precac_primary_freq);
-
- /*
- * Even if radar found on primary, we need to move
- * the channel from precac-required-list and precac-done-list
- * to precac-nol-list.
- */
- PRECAC_LIST_LOCK(dfs);
- if (TAILQ_EMPTY(&dfs->dfs_precac_list)) {
- PRECAC_LIST_UNLOCK(dfs);
- return;
- }
- for (i = 0; i < num_channels; i++) {
- TAILQ_FOREACH_SAFE(precac_entry,
- &dfs->dfs_precac_list,
- pe_list,
- tmp_precac_entry) {
- if (IS_WITHIN_RANGE(channels[i],
- precac_entry->vht80_ch_ieee,
- VHT80_OFFSET)) {
- dfs_mark_tree_node_as_nol(dfs,
- precac_entry,
- channels[i]);
- break;
- }
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
-
- psoc = wlan_pdev_get_psoc(dfs->dfs_pdev_obj);
- dfs_soc_obj = dfs->dfs_soc_obj;
-
- dfs_tx_ops = wlan_psoc_get_dfs_txops(psoc);
- pdev = dfs->dfs_pdev_obj;
-
- /* PreCAC timer is not running, no need to restart preCAC */
- if (!dfs_soc_obj->dfs_precac_timer_running)
- return;
-
- if (dfs_is_legacy_precac_enabled(dfs)) {
- qdf_timer_sync_cancel(&dfs_soc_obj->dfs_precac_timer);
- dfs_soc_obj->dfs_precac_timer_running = 0;
- /*
- * If radar is found on primary channel, no need to
- * restart VAP's channels since channel change will happen
- * after RANDOM channel selection anyway.
- */
- if (is_radar_found_on_secondary_seg) {
- /*
- * Change the channel
- * case 1:- No VHT80 channel for precac is available
- * so bring it back to VHT80.
- * case 2:- pick a new VHT80 channel for precac.
- */
- if (dfs_is_ap_cac_timer_running(dfs)) {
- dfs->dfs_defer_precac_channel_change = 1;
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "Primary CAC is running, defer the channel change"
- );
- } else {
- dfs_mlme_channel_change_by_precac(
- dfs->dfs_pdev_obj);
- }
- }
- } else if (dfs_is_agile_precac_enabled(dfs)) {
- /* If preCAC is not running on the DFS where radar is detected,
- * no need to configure agile channel.
- * Return from this function.
- */
- if (!(dfs_soc_obj->cur_precac_dfs_index == dfs->dfs_psoc_idx)) {
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "preCAC not running on radarfound DFS idx=%d",
- dfs->dfs_psoc_idx);
- return;
- }
-
- qdf_timer_sync_cancel(&dfs_soc_obj->dfs_precac_timer);
- dfs_soc_obj->dfs_precac_timer_running = 0;
-
- /* Since Agile DFS is interrupted due to radar, send
- * OCAC abort event to FW for a proper restart of the Agile
- * state machine.
- */
- if (dfs_tx_ops && dfs_tx_ops->dfs_ocac_abort_cmd)
- dfs_tx_ops->dfs_ocac_abort_cmd(pdev);
- /*
- * If radar is found on agile engine, change the channel here
- * since primary channel change will not be triggered.
- * If radar is found on primary detector, let agile
- * channel change be triggered after start response.
- * Set precac_state_started to false to indicate preCAC is not
- * running and also reset the current Agile channel.
- */
- if (detector_id == dfs_get_agile_detector_id(dfs)) {
- dfs_prepare_agile_precac_chan(dfs);
- } else {
- dfs->dfs_agile_precac_freq = 0;
- dfs_soc_obj->precac_state_started = PRECAC_NOT_STARTED;
- }
- }
-}
-#endif
/*
* dfs_mark_precac_nol_for_freq() - Mark a channel as preCAC NOL.
@@ -1827,7 +1071,6 @@
* @freq_list: frequency list.
* @num_channels: Number of channels.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs,
uint8_t is_radar_found_on_secondary_seg,
uint8_t detector_id,
@@ -1951,7 +1194,6 @@
}
}
}
-#endif
#ifdef QCA_SUPPORT_AGILE_DFS
#ifdef CONFIG_CHAN_FREQ_API
@@ -2016,6 +1258,7 @@
* 80P80/165MHz. It is zero for other channel widths.
* @chwidth: Agile channel width for which the completion event is received.
*/
+#ifdef QCA_SUPPORT_AGILE_DFS
void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
uint32_t ocac_status,
uint32_t center_freq_mhz1,
@@ -2079,43 +1322,6 @@
dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS, "Error Unknown");
}
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
- uint32_t ocac_status,
- uint32_t center_freq)
-{
- struct wlan_dfs *dfs = NULL;
- struct dfs_agile_cac_params adfs_param;
-
- dfs = wlan_pdev_get_dfs_obj(pdev);
-
- /* STOP TIMER irrespective of status */
- utils_dfs_cancel_precac_timer(pdev);
- if (ocac_status == OCAC_RESET) {
- dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS,
- "PreCAC timer reset, Sending Agile chan set command");
- dfs_prepare_agile_precac_chan(dfs);
- } else if (ocac_status == OCAC_CANCEL) {
- dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS,
- "PreCAC timer abort, agile precac stopped");
- } else if (ocac_status == OCAC_SUCCESS) {
- dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS,
- "PreCAC timer Completed for agile freq: %d",
- center_freq);
- /*
- * TRIGGER agile precac timer with 0sec timeout
- * with ocac_status 0 for old pdev
- */
- adfs_param.precac_chan = center_freq;
- adfs_param.precac_chwidth = dfs->dfs_precac_chwidth;
- dfs_start_agile_precac_timer(dfs,
- ocac_status,
- &adfs_param);
- } else {
- dfs_debug(NULL, WLAN_DEBUG_DFS_ALWAYS, "Error Unknown");
- }
-}
#endif
#endif
#endif
@@ -2130,7 +1336,6 @@
* @dfs: Pointer to wlan_dfs.
* @chan: Pointer to dfs_channel.
*/
-#ifdef CONFIG_CHAN_FREQ_API
#define VHT80_FREQ_OFFSET 30
void dfs_find_precac_secondary_vht80_chan(struct wlan_dfs *dfs,
struct dfs_channel *chan)
@@ -2152,36 +1357,12 @@
&chan->dfs_ch_mhz_freq_seg1,
&chan->dfs_ch_mhz_freq_seg2);
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-#define VHT80_IEEE_FREQ_OFFSET 6
-void dfs_find_precac_secondary_vht80_chan(struct wlan_dfs *dfs,
- struct dfs_channel *chan)
-{
- uint8_t first_primary_dfs_ch_ieee;
-
- first_primary_dfs_ch_ieee =
- dfs->dfs_precac_secondary_freq - VHT80_IEEE_FREQ_OFFSET;
-
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- first_primary_dfs_ch_ieee, 0,
- WLAN_PHYMODE_11AC_VHT80,
- &(chan->dfs_ch_freq),
- &(chan->dfs_ch_flags),
- &(chan->dfs_ch_flagext),
- &(chan->dfs_ch_ieee),
- &(chan->dfs_ch_vhtop_ch_freq_seg1),
- &(chan->dfs_ch_vhtop_ch_freq_seg2));
-}
-#endif
-#endif
/*
* dfs_precac_csa() - Intitiate CSA for preCAC channel switch.
* @dfs: pointer to wlan_dfs.
*/
#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_precac_csa(struct wlan_dfs *dfs)
{
/*
@@ -2202,28 +1383,6 @@
qdf_mem_free(dfs->dfs_autoswitch_chan);
dfs->dfs_autoswitch_chan = NULL;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_precac_csa(struct wlan_dfs *dfs)
-{
- /*
- * Save current chan into intermediate chan, so that
- * next time a DFS channel needs preCAC, there is no channel switch
- * until preCAC finishes.
- */
- dfs->dfs_precac_inter_chan = dfs->dfs_autoswitch_des_chan;
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "Use %d as intermediate channel for further channel changes",
- dfs->dfs_precac_inter_chan);
-
- if (NULL != global_dfs_to_mlme.mlme_precac_chan_change_csa)
- global_dfs_to_mlme.mlme_precac_chan_change_csa(dfs->dfs_pdev_obj,
- dfs->dfs_autoswitch_des_chan,
- dfs->dfs_autoswitch_des_mode);
- dfs->dfs_autoswitch_des_chan = 0;
-}
-#endif
-#endif
#endif
#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
@@ -2237,7 +1396,6 @@
*
* Return: true if precac done on home channel, else false.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static bool dfs_precac_check_home_chan_change(struct wlan_dfs *dfs)
{
struct dfs_channel *chan = dfs->dfs_autoswitch_chan;
@@ -2250,42 +1408,6 @@
return false;
}
#else
-#ifdef CONFIG_CHAN_NUM_API
-static bool dfs_precac_check_home_chan_change(struct wlan_dfs *dfs)
-{
- struct dfs_channel chan;
-
- qdf_mem_zero(&chan, sizeof(struct dfs_channel));
- if (QDF_STATUS_SUCCESS !=
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- dfs->dfs_autoswitch_des_chan, 0,
- dfs->dfs_autoswitch_des_mode,
- &chan.dfs_ch_freq,
- &chan.dfs_ch_flags,
- &chan.dfs_ch_flagext,
- &chan.dfs_ch_ieee,
- &chan.dfs_ch_vhtop_ch_freq_seg1,
- &chan.dfs_ch_vhtop_ch_freq_seg2)) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Channel %d not found for mode %d",
- dfs->dfs_autoswitch_des_chan,
- dfs->dfs_autoswitch_des_mode);
- return false;
- }
- /*
- * If desired channel is in precac done list,
- * Change channel to desired channel using CSA.
- */
- if (dfs->dfs_autoswitch_des_chan && dfs_is_precac_done(dfs, &chan)) {
- dfs_precac_csa(dfs);
- dfs->dfs_soc_obj->precac_state_started = false;
- return true;
- }
- return false;
-}
-#endif
-#endif
-#else
static inline bool dfs_precac_check_home_chan_change(struct wlan_dfs *dfs)
{
return false;
@@ -2321,7 +1443,6 @@
* Removes the channel from precac_required list and adds it to the
* precac_done_list. Triggers a precac channel change.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static os_timer_func(dfs_precac_timeout)
{
struct wlan_dfs *dfs = NULL;
@@ -2391,78 +1512,6 @@
}
}
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-static os_timer_func(dfs_precac_timeout)
-{
- struct wlan_dfs *dfs = NULL;
- struct dfs_soc_priv_obj *dfs_soc_obj = NULL;
- uint32_t current_time;
- bool is_cac_done_on_des_chan = false;
-
- OS_GET_TIMER_ARG(dfs_soc_obj, struct dfs_soc_priv_obj *);
-
- dfs = dfs_soc_obj->dfs_priv[dfs_soc_obj->cur_precac_dfs_index].dfs;
- dfs_soc_obj->dfs_precac_timer_running = 0;
-
- if (dfs_is_legacy_precac_enabled(dfs)) {
- /*
- * Remove the HT80 freq from the precac-required-list
- * and add it to the precac-done-list
- */
- dfs_mark_precac_done(dfs, dfs->dfs_precac_secondary_freq, 0,
- dfs->dfs_precac_chwidth);
- current_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "Pre-cac expired, Precac Secondary chan %u curr time %d",
- dfs->dfs_precac_secondary_freq,
- (current_time) / 1000);
- /*
- * Do vdev restart so that we can change
- * the secondary VHT80 channel.
- */
-
- /* check if CAC done on home channel */
- is_cac_done_on_des_chan = dfs_precac_check_home_chan_change(dfs);
- if (!is_cac_done_on_des_chan) {
- /*
- * Use same home channel, only change preCAC channel.
- */
-
- /*
- * TO BE DONE xxx : Need to lock the channel change.
- */
- dfs_mlme_channel_change_by_precac(dfs->dfs_pdev_obj);
- }
- } else if (dfs_is_agile_precac_enabled(dfs)) {
- current_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Pre-cac expired, Agile Precac chan %u curr time %d",
- dfs->dfs_agile_precac_freq,
- current_time / 1000);
- if (dfs_soc_obj->ocac_status == OCAC_SUCCESS) {
- dfs_soc_obj->ocac_status = OCAC_RESET;
- dfs_mark_precac_done(dfs,
- dfs->dfs_agile_precac_freq,
- 0,
- dfs->dfs_precac_chwidth);
- }
- /* check if CAC done on home channel */
- is_cac_done_on_des_chan = dfs_precac_check_home_chan_change(dfs);
- if (!is_cac_done_on_des_chan) {
- /*
- * Use same home channel, only change preCAC channel.
- */
-
- /*
- * TO BE DONE xxx : Need to lock the channel change.
- */
- dfs_prepare_agile_precac_chan(dfs);
- }
- }
-}
-#endif
-#endif
void dfs_zero_cac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj)
{
@@ -2486,33 +1535,11 @@
/* dfs_init_precac_tree_node() - Initialise the preCAC BSTree node with the
* provided values.
* @node: Precac_tree_node to be filled.
- * @chan: IEEE channel value.
- * @bandwidth: Bandwidth of the channel.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static inline void dfs_init_precac_tree_node(struct precac_tree_node *node,
- int chan,
- uint8_t bandwidth)
-{
- node->left_child = NULL;
- node->right_child = NULL;
- node->ch_ieee = (uint8_t)chan;
- node->n_caced_subchs = 0;
- node->n_nol_subchs = 0;
- node->n_valid_subchs = N_SUBCHS_FOR_BANDWIDTH(bandwidth);
- node->bandwidth = bandwidth;
-}
-#endif
-
-/* dfs_init_precac_tree_node() - Initialise the preCAC BSTree node with the
- * provided values.
- * @node: Precac_tree_node to be filled.
* @freq: IEEE channel freq value.
* @bandwidth: Bandwidth of the channel.
* @depth: Depth of the tree. The depth of the tree when the root is 160MHz
* channel is 4, 80MHz is 3, 40MHz is 2 and 20MHz is 1.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static inline void
dfs_init_precac_tree_node_for_freq(struct precac_tree_node *node,
uint16_t freq,
@@ -2530,54 +1557,6 @@
node->depth = depth;
}
-#endif
-
-/* dfs_insert_node_into_bstree() - Insert a new preCAC BSTree node.
- * @root: The preCAC BSTree root pointer.
- * @chan: IEEE channel value of the new node.
- * @bandwidth: Bandwidth of the channel.
- *
- * Return: EOK if new node is allocated, else return ENOMEM.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static QDF_STATUS
-dfs_insert_node_into_bstree(struct precac_tree_node **root,
- int chan,
- uint8_t bandwidth)
-{
- struct precac_tree_node *new_node = NULL;
- struct precac_tree_node *curr_node, *prev_node = NULL;
- QDF_STATUS status = EOK;
-
- new_node = qdf_mem_malloc(sizeof(*new_node));
- if (!new_node)
- return -ENOMEM;
- dfs_init_precac_tree_node(new_node, chan, bandwidth);
-
- /* If root node is null, assign the newly allocated node
- * to this node and return.
- */
- if (!(*root)) {
- *root = new_node;
- return status;
- }
-
- curr_node = *root;
- /* Find the leaf node which will be the new node's parent */
- while (curr_node) {
- prev_node = curr_node;
- curr_node = dfs_descend_precac_tree(curr_node, chan);
- }
-
- /* Add to the leaf node */
- if (chan < prev_node->ch_ieee)
- prev_node->left_child = new_node;
- else
- prev_node->right_child = new_node;
-
- return status;
-}
-#endif
/* dfs_insert_node_into_bstree_for_freq() - Insert a new preCAC BSTree node.
* @root: The preCAC BSTree root pointer.
@@ -2588,7 +1567,6 @@
*
* Return: EOK if new node is allocated, else return ENOMEM.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static QDF_STATUS
dfs_insert_node_into_bstree_for_freq(struct precac_tree_node **root,
uint16_t chan_freq,
@@ -2631,7 +1609,6 @@
return status;
}
-#endif
/* dfs fill_precac_tree_for_entry() - Fill precac entry tree (level insertion).
* @dfs: WLAN DFS structure
@@ -2655,50 +1632,7 @@
#define START_INDEX 0
#define STEP_INDEX 1
-#ifdef CONFIG_CHAN_NUM_API
-static QDF_STATUS
-dfs_create_precac_tree(struct wlan_dfs *dfs,
- struct dfs_precac_entry *precac_entry,
- uint8_t ch_ieee)
-{
- struct precac_tree_node *root = NULL;
- int chan, i, bandwidth = DFS_CHWIDTH_80_VAL;
- QDF_STATUS status = EOK;
- static const int initial_and_next_offsets[TREE_DEPTH_MAX][N_OFFSETS] = {
- {INITIAL_80_CHAN_OFFSET, NEXT_80_CHAN_OFFSET},
- {INITIAL_40_CHAN_OFFSET, NEXT_40_CHAN_OFFSET},
- {INITIAL_20_CHAN_OFFSET, NEXT_20_CHAN_OFFSET}
- };
- for (i = 0; i < TREE_DEPTH_MAX; i++) {
- /* In offset array,
- * column 0 is initial chan offset,
- * column 1 is next chan offset.
- * Boundary offset is initial offset and next offset
- * of root level (since root level can have only 1 node)
- */
- int offset = initial_and_next_offsets[i][START_INDEX];
- int step = initial_and_next_offsets[i][STEP_INDEX];
- uint8_t top_lvl_step = NEXT_80_CHAN_OFFSET;
- int boundary_offset = offset + top_lvl_step;
-
- for (; offset < boundary_offset; offset += step) {
- chan = (int)ch_ieee + offset;
- status = dfs_insert_node_into_bstree(&root,
- chan,
- bandwidth);
- if (status)
- return status;
- }
- bandwidth /= 2;
- }
-
- precac_entry->tree_root = root;
- return status;
-}
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
/**
* struct precac_tree_offset_for_different_bw - Bandwidth, tree depth and
* channel offsets information to build the precac tree.
@@ -2823,9 +1757,7 @@
return status;
}
-#endif
-#ifdef CONFIG_CHAN_FREQ_API
/**
* struct dfs_channel_bw - Structure to store the information about precac
* root's primary channel frequency, maximum bandwidth and the center frequency.
@@ -3188,100 +2120,6 @@
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "ieee=%u bw=%u", ch_ieee, bw);
}
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_init_precac_list(struct wlan_dfs *dfs)
-{
- u_int i;
- uint8_t found;
- struct dfs_precac_entry *tmp_precac_entry;
- int nchans = 0;
- QDF_STATUS status;
-
- /* Right now, only ETSI domain supports preCAC. Check if current
- * DFS domain is ETSI and only then build the preCAC list.
- */
- if (utils_get_dfsdomain(dfs->dfs_pdev_obj) != DFS_ETSI_DOMAIN)
- return;
-
- /*
- * We need to prepare list of uniq VHT80 center frequencies. But at the
- * beginning we do not know how many uniq frequencies are present.
- * Therefore, we calculate the MAX size and allocate a temporary
- * list/array. However we fill the temporary array with uniq frequencies
- * and copy the uniq list of frequencies to the final list with exact
- * size.
- */
- TAILQ_INIT(&dfs->dfs_precac_list);
- dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans);
-
- PRECAC_LIST_LOCK(dfs);
- /* Fill the precac_list with unique elements */
- for (i = 0; i < nchans; i++) {
- struct dfs_channel *ichan = NULL, lc;
- uint8_t pri_cntr_chan = 0;
-
- ichan = &lc;
- dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj,
- &(ichan->dfs_ch_freq),
- &(ichan->dfs_ch_flags),
- &(ichan->dfs_ch_flagext),
- &(ichan->dfs_ch_ieee),
- &(ichan->dfs_ch_vhtop_ch_freq_seg1),
- &(ichan->dfs_ch_vhtop_ch_freq_seg2),
- i);
- pri_cntr_chan = ichan->dfs_ch_vhtop_ch_freq_seg1;
-
- if (WLAN_IS_CHAN_11AC_VHT80(ichan) &&
- WLAN_IS_CHAN_DFS(ichan)) {
- found = 0;
- TAILQ_FOREACH(tmp_precac_entry,
- &dfs->dfs_precac_list,
- pe_list) {
- if (tmp_precac_entry->vht80_ch_ieee ==
- pri_cntr_chan) {
- found = 1;
- break;
- }
- }
- if (!found && pri_cntr_chan) {
- struct dfs_precac_entry *precac_entry;
-
- precac_entry = qdf_mem_malloc(
- sizeof(*precac_entry));
- if (!precac_entry) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "entry alloc fail for : %d", i);
- continue;
- }
- precac_entry->vht80_ch_ieee = pri_cntr_chan;
- precac_entry->dfs = dfs;
- status = dfs_create_precac_tree(dfs,
- precac_entry,
- pri_cntr_chan);
- if (status) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "tree_node alloc failed");
- continue;
- }
- TAILQ_INSERT_TAIL(
- &dfs->dfs_precac_list,
- precac_entry, pe_list);
- }
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
-
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "Print the list of VHT80 frequencies from linked list");
- TAILQ_FOREACH(tmp_precac_entry,
- &dfs->dfs_precac_list,
- pe_list)
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "freq=%u",
- tmp_precac_entry->vht80_ch_ieee);
-}
-#endif
-#endif
/* dfs_find_leftmost_leaf_of_precac_tree() - Find the leftmost leaf node of
* BSTree rooted by the given node.
@@ -3455,62 +2293,6 @@
}
#define DFS_160MHZ_SECSEG_CHAN_FREQ_OFFSET 40
-#ifdef CONFIG_CHAN_NUM_API
-/**
- * dfs_get_num_cur_subchans_in_node() - Get number of excluded channels
- * inside the current node.
- * @dfs: Pointer to wlan_dfs structure.
- * @node: Node to be checked.
- *
- * Return: uint8_t.
- * Return the number of excluded (current operating channels in CAC) that are in
- * the given tree node range.
- */
-static uint8_t
-dfs_get_num_cur_subchans_in_node(struct wlan_dfs *dfs,
- struct precac_tree_node *node)
-{
- uint16_t exclude_pri_ch_freq, exclude_sec_ch_freq, n_exclude_subchs = 0;
- uint8_t chwidth_val = DFS_CHWIDTH_80_VAL;
- struct dfs_channel *curchan = dfs->dfs_curchan;
-
- exclude_pri_ch_freq =
- utils_dfs_chan_to_freq(curchan->dfs_ch_vhtop_ch_freq_seg1);
- exclude_sec_ch_freq =
- utils_dfs_chan_to_freq(curchan->dfs_ch_vhtop_ch_freq_seg2);
- if (WLAN_IS_CHAN_MODE_160(curchan)) {
- if (exclude_sec_ch_freq < exclude_pri_ch_freq)
- exclude_sec_ch_freq -=
- DFS_160MHZ_SECSEG_CHAN_FREQ_OFFSET;
- else
- exclude_sec_ch_freq +=
- DFS_160MHZ_SECSEG_CHAN_FREQ_OFFSET;
- }
-
- if (WLAN_IS_CHAN_MODE_20(curchan))
- chwidth_val = DFS_CHWIDTH_20_VAL;
- else if (WLAN_IS_CHAN_MODE_40(curchan))
- chwidth_val = DFS_CHWIDTH_40_VAL;
-
- /* Check if the channel is a subset of the tree node and if it's
- * currently in CAC period. This is to avoid excluding channels twice,
- * one below and one in the already CACed channels exclusion (in the
- * caller API). */
- if (IS_WITHIN_RANGE(exclude_pri_ch_freq,
- node->ch_freq,
- (node->bandwidth / 2)) &&
- dfs_is_pcac_required_for_freq(node, exclude_pri_ch_freq))
- n_exclude_subchs += N_SUBCHS_FOR_BANDWIDTH(chwidth_val);
- if (IS_WITHIN_RANGE(exclude_sec_ch_freq,
- node->ch_freq,
- (node->bandwidth / 2)) &&
- dfs_is_pcac_required_for_freq(node, exclude_sec_ch_freq))
- n_exclude_subchs += N_SUBCHS_FOR_BANDWIDTH(chwidth_val);
- return n_exclude_subchs;
-}
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
/**
* dfs_get_num_cur_subchans_in_node_freq() - Get number of excluded channels
* inside the current node.
@@ -3563,55 +2345,7 @@
n_exclude_subchs += N_SUBCHS_FOR_BANDWIDTH(chwidth_val);
return n_exclude_subchs;
}
-#endif
-#ifdef CONFIG_CHAN_NUM_API
-/* dfs_is_cac_needed_for_bst_node() - For a requested bandwidth, find
- * if the current preCAC BSTree node needs
- * CAC.
- * @dfs: Pointer to wlan_dfs structure.
- * @node: Node to be checked.
- * @req_bandwidth: bandwidth of channel requested.
- *
- * Return: TRUE/FALSE.
- * Return true if there exists a channel of the requested bandwidth
- * for the node which is not CAC done, else false.
- */
-static bool
-dfs_is_cac_needed_for_bst_node(struct wlan_dfs *dfs,
- struct precac_tree_node *node,
- uint8_t req_bandwidth)
-{
- uint8_t n_subchs_for_req_bw, n_allowed_subchs, n_excluded_subchs;
-
- if (!node)
- return false;
-
- /* Find the number of subchannels for the requested bandwidth */
- n_excluded_subchs = dfs_get_num_cur_subchans_in_node(dfs, node);
- n_subchs_for_req_bw = N_SUBCHS_FOR_BANDWIDTH(req_bandwidth);
- n_allowed_subchs = node->n_valid_subchs -
- (node->n_nol_subchs + n_excluded_subchs);
-
- /* Return false if,
- * 1. Number of allowed subchannels (all subchannels other than
- * current operating sub-channels and NOL sub-channels) in the
- * current node is less than the requested number of subchannels.
- * 3. If the number CAC done subchannels + NOL subchannels + current
- * operating subchannels in the current node is equal to number of
- * valid subchannels in the node.
- * else, return true.
- */
- if ((n_allowed_subchs < n_subchs_for_req_bw) ||
- ((node->n_caced_subchs + node->n_nol_subchs + n_excluded_subchs) ==
- node->n_valid_subchs))
- return false;
-
- return true;
-}
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
/* dfs_is_cac_needed_for_bst_node_for_freq() - For a requested bandwidth, find
* if the current preCAC BSTree
* node needs CAC.
@@ -3655,55 +2389,6 @@
return true;
}
-#endif
-
-/* dfs_find_ieee_ch_from_precac_tree() - from the given preCAC tree, find a IEEE
- * channel of the given bandwidth which
- * is valid and needs CAC.
- * @root: PreCAC BSTree root pointer.
- * @req_bw: Bandwidth of channel requested.
- *
- * Return: IEEE channel number.
- * Return a valid IEEE value which needs CAC for the given bandwidth, else
- * return 0.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static uint8_t
-dfs_find_ieee_ch_from_precac_tree(struct wlan_dfs *dfs,
- struct precac_tree_node *root,
- uint8_t req_bw)
-{
- struct precac_tree_node *curr_node;
-
- if (!dfs_is_cac_needed_for_bst_node(dfs, root, req_bw))
- return 0;
-
- curr_node = root;
- while (curr_node) {
- if (curr_node->bandwidth == req_bw) {
- /* find if current node in valid state (req.) */
- if (dfs_is_cac_needed_for_bst_node(dfs,
- curr_node,
- req_bw))
- return curr_node->ch_ieee;
- else
- return 0;
- }
-
- /* Find if we need to go to left or right subtree.
- * Note: If both are available, go to left.
- */
- if (!dfs_is_cac_needed_for_bst_node(dfs,
- curr_node->left_child,
- req_bw))
- curr_node = curr_node->right_child;
- else
- curr_node = curr_node->left_child;
- }
- /* If requested bandwidth is invalid, return 0 here */
- return 0;
-}
-#endif
/* dfs_find_ieee_ch_from_precac_tree_for_freq() - from the given preCAC tree,
* find a IEEE freq of the given bandwidth
@@ -3715,7 +2400,6 @@
* Return a valid freq value which needs CAC for the given bandwidth, else
* return 0.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static uint16_t
dfs_find_ieee_ch_from_precac_tree_for_freq(struct wlan_dfs *dfs,
struct precac_tree_node *root,
@@ -3752,43 +2436,6 @@
/* If requested bandwidth is invalid, return 0 here */
return 0;
}
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-uint8_t dfs_get_ieeechan_for_precac(struct wlan_dfs *dfs,
- uint8_t exclude_pri_ch_ieee,
- uint8_t exclude_sec_ch_ieee,
- uint8_t bandwidth)
-{
- struct dfs_precac_entry *precac_entry;
- struct precac_tree_node *root = NULL;
- uint8_t ieee_chan = 0;
-
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "current operating channel(s) to be excluded = [%u] [%u]",
- exclude_pri_ch_ieee,
- exclude_sec_ch_ieee);
-
- PRECAC_LIST_LOCK(dfs);
- if (!TAILQ_EMPTY(&dfs->dfs_precac_list)) {
- TAILQ_FOREACH(precac_entry, &dfs->dfs_precac_list,
- pe_list) {
- root = precac_entry->tree_root;
- ieee_chan =
- dfs_find_ieee_ch_from_precac_tree(dfs,
- root,
- bandwidth);
- if (ieee_chan)
- break;
- }
- }
- PRECAC_LIST_UNLOCK(dfs);
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "Channel picked for preCAC = %u",
- ieee_chan);
-
- return ieee_chan;
-}
-#endif
#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
#ifdef CONFIG_CHAN_FREQ_API
@@ -3897,7 +2544,6 @@
* @exclude_sec_ch_freq: Secondary freqeuncy to be excluded.
* @bandwidth: Bandwidth.
*/
-#ifdef CONFIG_CHAN_FREQ_API
uint16_t dfs_get_ieeechan_for_precac_for_freq(struct wlan_dfs *dfs,
uint16_t exclude_pri_ch_freq,
uint16_t exclude_sec_ch_freq,
@@ -3940,7 +2586,6 @@
return ieee_chan_freq;
}
-#endif
void dfs_cancel_precac_timer(struct wlan_dfs *dfs)
{
@@ -3962,55 +2607,9 @@
* and if the last channel of given range is right of the first weather channel,
* return true, else false.
*/
-#ifdef CONFIG_CHAN_NUM_API
-#define FIND_IF_OVERLAP_WITH_WEATHER_RANGE(first_ch, last_ch) \
-((first_ch <= WEATHER_CHAN_END) && (WEATHER_CHAN_START <= last_ch))
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
#define FIND_IF_OVERLAP_WITH_WEATHER_FREQ_RANGE(first_ch_freq, last_ch_freq) \
((first_ch_freq <= WEATHER_CHAN_END_FREQ) && (last_ch_freq >= \
WEATHER_CHAN_START_FREQ))
-#endif
-/* dfs_is_precac_on_weather_channel() - Given a channel number, find if
- * it's a weather radar channel.
- * @dfs: Pointer to WLAN_DFS structure.
- * @chwidth: PreCAC channel width enum.
- * @precac_chan: Channel for preCAC.
- *
- * Based on the precac_width, find the first and last subchannels of the given
- * preCAC channel and check if this range overlaps with weather channel range.
- *
- * Return: True if weather channel, else false.
- */
-#ifdef CONFIG_CHAN_NUM_API
-static bool dfs_is_precac_on_weather_channel(struct wlan_dfs *dfs,
- enum phy_ch_width chwidth,
- uint8_t precac_chan)
-{
- uint8_t first_subch, last_subch;
-
- switch (chwidth) {
- case CH_WIDTH_20MHZ:
- first_subch = precac_chan;
- last_subch = precac_chan;
- break;
- case CH_WIDTH_40MHZ:
- first_subch = precac_chan - DFS_5GHZ_NEXT_CHAN_OFFSET;
- last_subch = precac_chan + DFS_5GHZ_NEXT_CHAN_OFFSET;
- break;
- case CH_WIDTH_80MHZ:
- first_subch = precac_chan - DFS_5GHZ_2ND_CHAN_OFFSET;
- last_subch = precac_chan + DFS_5GHZ_2ND_CHAN_OFFSET;
- break;
- default:
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Precac channel width invalid!");
- return false;
- }
- return FIND_IF_OVERLAP_WITH_WEATHER_RANGE(first_subch, last_subch);
-}
-#endif
/* dfs_is_pcac_on_weather_channel_for_freq() - Given a channel number, find if
* it's a weather radar channel.
@@ -4023,7 +2622,6 @@
*
* Return: True if weather channel, else false.
*/
-#ifdef CONFIG_CHAN_FREQ_API
static bool dfs_is_pcac_on_weather_channel_for_freq(struct wlan_dfs *dfs,
enum phy_ch_width chwidth,
uint16_t precac_freq)
@@ -4063,7 +2661,6 @@
}
return FIND_IF_OVERLAP_WITH_WEATHER_FREQ_RANGE(first_subch, last_subch);
}
-#endif
/*
* dfs_start_agile_precac_timer() - Start Agile preCAC timer.
@@ -4072,7 +2669,6 @@
* @adfs_param: Pointer to ADFS params.
*/
#define EXTRA_TIME_IN_MS 2000
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
uint8_t ocac_status,
struct dfs_agile_cac_params *adfs_param)
@@ -4120,131 +2716,6 @@
min_precac_timeout += EXTRA_TIME_IN_MS;
qdf_timer_mod(&dfs_soc_obj->dfs_precac_timer, min_precac_timeout);
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
- uint8_t ocac_status,
- struct dfs_agile_cac_params *adfs_param)
-{
- uint8_t precac_chan = adfs_param->precac_chan;
- enum phy_ch_width chwidth = adfs_param->precac_chwidth;
- uint32_t min_precac_timeout, max_precac_timeout;
- struct dfs_soc_priv_obj *dfs_soc_obj;
-
- dfs_soc_obj = dfs->dfs_soc_obj;
- dfs_soc_obj->dfs_precac_timer_running = 1;
-
- if (ocac_status == OCAC_SUCCESS) {
- dfs_soc_obj->ocac_status = OCAC_SUCCESS;
- min_precac_timeout = 0;
- max_precac_timeout = 0;
- } else {
- /* Find the minimum and maximum precac timeout. */
- max_precac_timeout = MAX_PRECAC_DURATION;
- if (dfs->dfs_precac_timeout_override != -1) {
- min_precac_timeout =
- dfs->dfs_precac_timeout_override * 1000;
- } else if (dfs_is_precac_on_weather_channel(dfs,
- chwidth,
- precac_chan)) {
- min_precac_timeout = MIN_WEATHER_PRECAC_DURATION;
- max_precac_timeout = MAX_WEATHER_PRECAC_DURATION;
- } else {
- min_precac_timeout = MIN_PRECAC_DURATION;
- }
- }
-
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "precactimeout = %d ms", (min_precac_timeout));
- /* Add the preCAC timeout in the params to be sent to FW. */
- adfs_param->min_precac_timeout = min_precac_timeout;
- adfs_param->max_precac_timeout = max_precac_timeout;
- /* Increase the preCAC timeout in HOST by 2 seconds to avoid
- * FW OCAC completion event and HOST timer firing at same time. */
- if (min_precac_timeout)
- min_precac_timeout += EXTRA_TIME_IN_MS;
- qdf_timer_mod(&dfs_soc_obj->dfs_precac_timer, min_precac_timeout);
-}
-#endif
-#endif
-#endif
-
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_start_precac_timer(struct wlan_dfs *dfs,
- uint8_t precac_chan)
-{
- struct dfs_channel *ichan, lc;
- uint8_t first_primary_dfs_ch_ieee;
- int primary_cac_timeout;
- int secondary_cac_timeout;
- int precac_timeout;
- struct dfs_soc_priv_obj *dfs_soc_obj;
- struct dfs_channel *dfs_curchan;
-
- dfs_soc_obj = dfs->dfs_soc_obj;
- dfs = dfs_soc_obj->dfs_priv[dfs_soc_obj->cur_precac_dfs_index].dfs;
-#define EXTRA_TIME_IN_SEC 5
- dfs_soc_obj->dfs_precac_timer_running = 1;
-
- /*
- * Get the first primary ieee chan in the HT80 band and find the channel
- * pointer.
- */
- dfs_curchan = dfs->dfs_curchan;
- first_primary_dfs_ch_ieee = precac_chan - VHT80_FREQ_OFFSET;
-
- primary_cac_timeout =
- dfs_mlme_get_cac_timeout(dfs->dfs_pdev_obj,
- dfs_curchan->dfs_ch_freq,
- dfs_curchan->dfs_ch_vhtop_ch_freq_seg2,
- dfs_curchan->dfs_ch_flags);
-
- ichan = &lc;
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- first_primary_dfs_ch_ieee, 0,
- WLAN_PHYMODE_11AC_VHT80,
- &ichan->dfs_ch_freq,
- &ichan->dfs_ch_flags,
- &ichan->dfs_ch_flagext,
- &ichan->dfs_ch_ieee,
- &ichan->dfs_ch_vhtop_ch_freq_seg1,
- &ichan->dfs_ch_vhtop_ch_freq_seg2);
-
- secondary_cac_timeout = (dfs->dfs_precac_timeout_override != -1) ?
- dfs->dfs_precac_timeout_override :
- dfs_mlme_get_cac_timeout(dfs->dfs_pdev_obj,
- ichan->dfs_ch_freq,
- ichan->dfs_ch_vhtop_ch_freq_seg2,
- ichan->dfs_ch_flags);
-
- /*
- * EXTRA time is needed so that if CAC and PreCAC is running
- * simultaneously, PreCAC expiry function may be called before CAC
- * expiry and PreCAC expiry does a channel change (vdev_restart) the
- * restart response calls CAC_start function(ieee80211_dfs_cac_start)
- * which cancels any previous CAC timer and starts a new CAC again.
- * So CAC expiry does not happen and moreover a new CAC is started.
- * Therefore do not disturb the CAC by channel restart (vdev_restart).
- *
- * If CAC/preCAC was already completed on primary, then we do not need
- * to calculate which CAC timeout is maximum.
- * For example: If primary's CAC is 600 seconds and secondary's CAC
- * is 60 seconds then maximum gives 600 seconds which is not needed
- * if CAC/preCAC was already completed on primary. It is to be noted
- * that etsi_precac/cac is done on primary segment.
- */
- if (WLAN_IS_CHAN_DFS(dfs->dfs_curchan) &&
- !dfs_is_precac_done(dfs, dfs->dfs_curchan))
- precac_timeout = QDF_MAX(primary_cac_timeout,
- secondary_cac_timeout) +
- EXTRA_TIME_IN_SEC;
- else
- precac_timeout = secondary_cac_timeout + EXTRA_TIME_IN_SEC;
-
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "precactimeout = %d", (precac_timeout) * 1000);
- qdf_timer_mod(&dfs_soc_obj->dfs_precac_timer, (precac_timeout) * 1000);
-}
#endif
/*
@@ -4252,7 +2723,6 @@
* @dfs: pointer to wlan_dfs.
* @precac_chan_freq: PreCAC channel frequency
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_start_precac_timer_for_freq(struct wlan_dfs *dfs,
uint16_t precac_chan_freq)
{
@@ -4330,7 +2800,6 @@
"precactimeout = %d", (precac_timeout)*1000);
qdf_timer_mod(&dfs_soc_obj->dfs_precac_timer, (precac_timeout) * 1000);
}
-#endif
/* dfs_print_node_data() - Print the precac tree node data.
* @dfs: Pointer to WLAN DFS structure.
@@ -4534,17 +3003,16 @@
* @mode: Wireless mode of channel.
*/
#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
-#ifdef CONFIG_CHAN_NUM_API
void dfs_set_precac_preferred_channel(struct wlan_dfs *dfs,
struct dfs_channel *chan, uint8_t mode)
{
bool found = false;
- uint8_t freq_160_sec = 0;
+ uint16_t freq_160_sec_mhz = 0;
struct dfs_precac_entry *precac_entry;
if (dfs_is_precac_timer_running(dfs) &&
WLAN_IS_CHAN_MODE_80(chan) &&
- (dfs->dfs_precac_secondary_freq == chan->dfs_ch_freq)) {
+ (dfs->dfs_precac_secondary_freq_mhz == chan->dfs_ch_freq)) {
return;
}
@@ -4556,8 +3024,8 @@
!TAILQ_EMPTY(&dfs->dfs_precac_list)) {
TAILQ_FOREACH(precac_entry,
&dfs->dfs_precac_list, pe_list) {
- if (precac_entry->vht80_ch_ieee ==
- chan->dfs_ch_vhtop_ch_freq_seg1) {
+ if (precac_entry->vht80_ch_freq ==
+ chan->dfs_ch_mhz_freq_seg1) {
found = true;
TAILQ_REMOVE(&dfs->dfs_precac_list,
precac_entry, pe_list);
@@ -4570,18 +3038,18 @@
if (WLAN_IS_CHAN_MODE_160(chan) && WLAN_IS_CHAN_DFS(chan) &&
!TAILQ_EMPTY(&dfs->dfs_precac_list)) {
- if (chan->dfs_ch_ieee < chan->dfs_ch_vhtop_ch_freq_seg2)
- freq_160_sec = chan->dfs_ch_vhtop_ch_freq_seg1 +
- VHT160_IEEE_FREQ_DIFF;
+ if (chan->dfs_ch_freq < chan->dfs_ch_mhz_freq_seg2)
+ freq_160_sec_mhz = chan->dfs_ch_mhz_freq_seg1 +
+ VHT160_FREQ_DIFF;
else
- freq_160_sec = chan->dfs_ch_vhtop_ch_freq_seg1 -
- VHT160_IEEE_FREQ_DIFF;
+ freq_160_sec_mhz = chan->dfs_ch_mhz_freq_seg1 -
+ VHT160_FREQ_DIFF;
found = false;
TAILQ_FOREACH(precac_entry,
&dfs->dfs_precac_list, pe_list) {
- if (precac_entry->vht80_ch_ieee ==
- freq_160_sec) {
+ if (precac_entry->vht80_ch_freq ==
+ freq_160_sec_mhz) {
found = true;
TAILQ_REMOVE(&dfs->dfs_precac_list,
precac_entry, pe_list);
@@ -4600,57 +3068,7 @@
return;
}
}
-#endif
-#ifdef CONFIG_CHAN_NUM_API
-bool
-dfs_decide_precac_preferred_chan(struct wlan_dfs *dfs,
- uint8_t *pref_chan,
- enum wlan_phymode mode)
-{
- struct dfs_channel chan;
-
- qdf_mem_zero(&chan, sizeof(struct dfs_channel));
- if (QDF_STATUS_SUCCESS !=
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- *pref_chan, 0,
- mode,
- &chan.dfs_ch_freq,
- &chan.dfs_ch_flags,
- &chan.dfs_ch_flagext,
- &chan.dfs_ch_ieee,
- &chan.dfs_ch_vhtop_ch_freq_seg1,
- &chan.dfs_ch_vhtop_ch_freq_seg2))
- return false;
- if (!dfs->dfs_precac_inter_chan)
- return false;
-
- /*
- * If precac is done on this channel use it, else use a intermediate
- * non-DFS channel and trigger a precac on this channel.
- */
- if ((WLAN_IS_CHAN_DFS(&chan) ||
- (WLAN_IS_CHAN_MODE_160(&chan) &&
- WLAN_IS_CHAN_DFS_CFREQ2(&chan))) &&
- !dfs_is_precac_done(dfs, &chan)) {
- dfs_set_precac_preferred_channel(dfs, &chan, mode);
- dfs->dfs_autoswitch_des_chan = *pref_chan;
- dfs->dfs_autoswitch_des_mode = mode;
- *pref_chan = dfs->dfs_precac_inter_chan;
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "des_chan=%d, des_mode=%d. Current operating channel=%d",
- dfs->dfs_autoswitch_des_chan,
- dfs->dfs_autoswitch_des_mode,
- *pref_chan);
- return true;
- }
-
- dfs->dfs_precac_inter_chan = chan.dfs_ch_ieee;
- return false;
-}
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
bool
dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs,
uint16_t *pref_chan_freq,
@@ -4708,71 +3126,7 @@
qdf_mem_free(chan);
return false;
}
-#endif
-#ifdef CONFIG_CHAN_NUM_API
-enum precac_chan_state
-dfs_get_precac_chan_state(struct wlan_dfs *dfs, uint8_t precac_chan)
-{
- struct dfs_channel chan;
- struct dfs_precac_entry *tmp_precac_entry;
- struct precac_tree_node *root = NULL;
- enum precac_chan_state ret = PRECAC_ERR;
-
- qdf_mem_zero(&chan, sizeof(struct dfs_channel));
- if (QDF_STATUS_SUCCESS !=
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- precac_chan, 0,
- WLAN_PHYMODE_11AC_VHT80,
- &chan.dfs_ch_freq,
- &chan.dfs_ch_flags,
- &chan.dfs_ch_flagext,
- &chan.dfs_ch_ieee,
- &chan.dfs_ch_vhtop_ch_freq_seg1,
- &chan.dfs_ch_vhtop_ch_freq_seg2)) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Intermediate channel not found");
- return PRECAC_ERR;
- }
-
- if (!WLAN_IS_CHAN_DFS(&chan)) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "[%d] Not a DFS channel", precac_chan);
- return PRECAC_ERR;
- }
-
- PRECAC_LIST_LOCK(dfs);
- if (dfs_is_precac_timer_running(dfs)) {
- tmp_precac_entry = TAILQ_FIRST(&dfs->dfs_precac_list);
- if (tmp_precac_entry && (tmp_precac_entry->vht80_ch_ieee ==
- chan.dfs_ch_vhtop_ch_freq_seg1)) {
- ret = PRECAC_NOW;
- goto end;
- }
- }
-
- TAILQ_FOREACH(tmp_precac_entry,
- &dfs->dfs_precac_list, pe_list) {
- if (tmp_precac_entry->vht80_ch_ieee ==
- chan.dfs_ch_vhtop_ch_freq_seg1) {
- root = tmp_precac_entry->tree_root;
- if (root->n_nol_subchs)
- ret = PRECAC_NOL;
- else if (root->n_caced_subchs ==
- N_SUBCHS_FOR_BANDWIDTH(root->bandwidth))
- ret = PRECAC_DONE;
- else
- ret = PRECAC_REQUIRED;
- goto end;
- }
- }
-end:
- PRECAC_LIST_UNLOCK(dfs);
- return ret;
-}
-#endif
-
-#ifdef CONFIG_CHAN_FREQ_API
enum precac_chan_state
dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs, uint16_t pcac_freq)
{
@@ -4835,7 +3189,6 @@
return ret;
}
#endif
-#endif
#ifdef QCA_SUPPORT_AGILE_DFS
/* dfs_translate_chwidth_enum2val() - Translate the given channel width enum
@@ -4896,59 +3249,6 @@
}
}
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_get_ieeechan_for_agilecac(struct wlan_dfs *dfs,
- uint8_t *ch_ieee,
- uint8_t pri_ch_ieee,
- uint8_t sec_ch_ieee)
-{
- uint8_t ieee_chan, chwidth_val;
- enum phy_ch_width chwidth = CH_WIDTH_INVALID;
-
- /*
- * Agile detector's band of operation depends on current pdev.
- * Find the current channel's width and apply the translate rules
- * to find the Agile detector bandwidth.
- * Translate rules (all numbers are in MHz) from current pdev's width
- * to Agile detector's width:
- * 20 - 20, 40 - 40, 80 - 80, 160 - 80, 160 (non contiguous) - 80.
- */
- dfs_find_chwidth_and_center_chan(dfs, &chwidth, NULL, NULL);
-
- /* Check if the FW supports agile DFS when the pdev is operating on
- * 160 or 80P80MHz bandwidth. This information is stored in the flag
- * "dfs_fw_adfs_support_160" when the current chainmask is configured.
- */
- if ((chwidth == CH_WIDTH_80P80MHZ || chwidth == CH_WIDTH_160MHZ) &&
- (!dfs->dfs_fw_adfs_support_160)) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "aDFS during 160MHz operation not supported by target");
- return;
- }
- dfs->dfs_precac_chwidth = dfs_map_to_agile_width(dfs, chwidth);
- if (dfs->dfs_precac_chwidth == CH_WIDTH_INVALID) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "cannot start agile CAC!");
- return;
- }
- /* Find chwidth value for the given enum */
- chwidth_val = dfs_translate_chwidth_enum2val(dfs,
- dfs->dfs_precac_chwidth);
-
- dfs->dfs_soc_obj->ocac_status = OCAC_RESET;
-
- ieee_chan = dfs_get_ieeechan_for_precac(dfs,
- pri_ch_ieee,
- sec_ch_ieee,
- chwidth_val);
- if (ieee_chan)
- dfs->dfs_agile_precac_freq = ieee_chan;
- else
- dfs->dfs_agile_precac_freq = 0;
-
- *ch_ieee = dfs->dfs_agile_precac_freq;
-}
-#endif
-
#ifdef QCA_SUPPORT_ADFS_RCAC
/* dfs_fill_des_rcac_chan_params() - Fill ch_params from dfs current channel.
@@ -5389,7 +3689,6 @@
* @pri_ch_freq: Primary channel frequency.
* @sec_ch_freq: Secondary channel frequency.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs,
qdf_freq_t *ch_freq,
qdf_freq_t pri_ch_freq,
@@ -5433,126 +3732,7 @@
qdf_info("%s: No valid Agile channels available in the current pdev", __func__);
}
#endif
-#endif
-#ifdef CONFIG_CHAN_NUM_API
-void dfs_find_vht80_chan_for_precac(struct wlan_dfs *dfs,
- uint32_t chan_mode,
- uint8_t ch_freq_seg1,
- uint32_t *cfreq1,
- uint32_t *cfreq2,
- uint32_t *phy_mode,
- bool *dfs_set_cfreq2,
- bool *set_agile)
-{
- uint8_t ieee_freq;
- uint8_t chwidth_val = DFS_CHWIDTH_80_VAL;
-
- if (chan_mode != WLAN_PHYMODE_11AC_VHT80)
- return;
-
- dfs->dfs_precac_chwidth = CH_WIDTH_80MHZ;
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "precac_secondary_freq = %u precac_running = %u",
- dfs->dfs_precac_secondary_freq,
- dfs->dfs_soc_obj->dfs_precac_timer_running);
-
- /*
- * If Pre-CAC is enabled then find a center frequency for
- * the secondary VHT80 and Change the mode to
- * VHT80_80 or VHT160.
- */
- if (dfs_is_legacy_precac_enabled(dfs)) {
- /*
- * If precac timer is running then do not change the
- * secondary channel use the old secondary VHT80
- * channel. If precac timer is not running then try to
- * find a new channel from precac-list.
- */
- if (dfs->dfs_soc_obj->dfs_precac_timer_running) {
- /*
- * Primary and secondary VHT80 cannot be the
- * same. Therefore exclude the primary
- * frequency while getting new channel from
- * precac-list.
- */
- if (ch_freq_seg1 ==
- dfs->dfs_precac_secondary_freq)
- ieee_freq =
- dfs_get_ieeechan_for_precac(dfs,
- ch_freq_seg1,
- 0,
- chwidth_val);
- else
- ieee_freq = dfs->dfs_precac_secondary_freq;
- } else
- ieee_freq = dfs_get_ieeechan_for_precac(dfs,
- ch_freq_seg1,
- 0,
- chwidth_val);
- if (ieee_freq) {
- if (ieee_freq == (ch_freq_seg1 +
- VHT160_IEEE_FREQ_DIFF)) {
- /*
- * Override the HW channel mode to
- * VHT160
- */
- uint8_t ieee_160_cfreq;
-
- ieee_160_cfreq = (ieee_freq + ch_freq_seg1) / 2;
- chan_mode = WLAN_PHYMODE_11AC_VHT160;
- *cfreq1 = dfs_mlme_ieee2mhz(dfs->dfs_pdev_obj,
- ch_freq_seg1,
- WLAN_CHAN_5GHZ);
- *cfreq2 = dfs_mlme_ieee2mhz(dfs->dfs_pdev_obj,
- ieee_160_cfreq,
- WLAN_CHAN_5GHZ);
- } else {
- /*
- * Override the HW channel mode to
- * VHT80_80.
- */
- chan_mode = WLAN_PHYMODE_11AC_VHT80_80;
- *cfreq2 = dfs_mlme_ieee2mhz(dfs->dfs_pdev_obj,
- ieee_freq,
- WLAN_CHAN_5GHZ);
- }
- *phy_mode = lmac_get_phymode_info(dfs->dfs_pdev_obj,
- chan_mode);
- *dfs_set_cfreq2 = true;
-
- /*
- * Finally set the agile flag.
- * When we want a full calibration of both
- * primary VHT80 and secondary VHT80 the agile
- * flag is set to FALSE else set to TRUE. When
- * a channel is being set for the first time
- * this flag must be FALSE because first time
- * the entire channel must be calibrated. All
- * subsequent times the flag must be set to TRUE
- * if we are changing only the secondary VHT80.
- */
- if (dfs->dfs_precac_primary_freq == ch_freq_seg1)
- *set_agile = true;
- else
- *set_agile = false;
-
- dfs_debug(dfs, WLAN_DEBUG_DFS,
- "cfreq1 = %u cfreq2 = %u ieee_freq = %u mode = %u set_agile = %d",
- *cfreq1, *cfreq2, ieee_freq,
- chan_mode, *set_agile);
-
- dfs->dfs_precac_secondary_freq = ieee_freq;
- dfs->dfs_precac_primary_freq = ch_freq_seg1;
- /* Start the pre_cac_timer */
- dfs_start_precac_timer(dfs,
- dfs->dfs_precac_secondary_freq);
- } else {
- dfs->dfs_precac_secondary_freq = 0;
- } /* End of if(ieee_freq) */
- } /* End of if(dfs_is_legacy_precac_enabled(dfs)) */
-}
-#endif
/*
* dfs_find_vht80_chan_for_precac_for_freq() - Find VHT80 channel for preCAC.
@@ -5565,7 +3745,6 @@
* @dfs_set_cfreq2: Flag to indicate if cfreq2 is set.
* @set_agile: Flag to set agile.
*/
-#ifdef CONFIG_CHAN_FREQ_API
void dfs_find_vht80_chan_for_precac_for_freq(struct wlan_dfs *dfs,
uint32_t chan_mode,
uint16_t cfreq_seg1_mhz,
@@ -5671,7 +3850,6 @@
} /* End of if(ieee_freq) */
} /* End of if(dfs_is_legacy_precac_enabled(dfs)) */
}
-#endif
void dfs_set_precac_enable(struct wlan_dfs *dfs, uint32_t value)
{
@@ -5789,7 +3967,6 @@
* @dfs: Pointer to wlan_dfs.
* @freq: Channel frequency in MHZ.
*/
-#ifdef CONFIG_CHAN_FREQ_API
int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, uint32_t freq)
{
struct dfs_channel chan;
@@ -5825,65 +4002,17 @@
return 0;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, uint32_t value)
-{
- struct dfs_channel chan;
-
- qdf_mem_zero(&chan, sizeof(struct dfs_channel));
- if (QDF_STATUS_SUCCESS !=
- dfs_mlme_find_dot11_channel(dfs->dfs_pdev_obj,
- value, 0,
- WLAN_PHYMODE_11AC_VHT80,
- &chan.dfs_ch_freq,
- &chan.dfs_ch_flags,
- &chan.dfs_ch_flagext,
- &chan.dfs_ch_ieee,
- &chan.dfs_ch_vhtop_ch_freq_seg1,
- &chan.dfs_ch_vhtop_ch_freq_seg2)) {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
- "Intermediate channel not found");
- return -EINVAL;
- }
-
- /*Intermediate channel should be non-DFS channel*/
- if (!WLAN_IS_CHAN_DFS(&chan)) {
- dfs->dfs_precac_inter_chan = value;
- } else {
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "intermediate channel %s",
- (chan.dfs_ch_ieee == value) ?
- "should not be DFS channel" : "is invalid");
- dfs->dfs_precac_inter_chan = 0;
- return -EINVAL;
- }
-
- return 0;
-}
#endif
-#endif
-#endif
-
/*
* dfs_get_precac_intermediate_chan() - Get interCAC channel.
* @dfs: Pointer to wlan_dfs.
*/
#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
-#ifdef CONFIG_CHAN_FREQ_API
uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs)
{
return dfs->dfs_precac_inter_chan_freq;
}
-#else
-#ifdef CONFIG_CHAN_NUM_API
-uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs)
-{
- return dfs->dfs_precac_inter_chan;
-}
#endif
-#endif
-#endif
-
#ifdef QCA_SUPPORT_AGILE_DFS
void dfs_reset_agile_config(struct dfs_soc_priv_obj *dfs_soc)
{