qcacmn: Add macro QCA_SUPPORT_DFS_CAC

Conditional compile dfs_cac functionalities to
avoid compilation issues.

Change-Id: Id81b51f071f9abfb666231f2b2005d3c594b7d1a
CRs-Fixed: 2843645
This commit is contained in:
Vijay Krishnan
2020-12-22 15:17:51 +05:30
committed by snandini
parent 16066cae2b
commit d56177bd21
3 changed files with 185 additions and 177 deletions

View File

@@ -2160,34 +2160,34 @@ void dfs_destroy_object(struct wlan_dfs *dfs);
*/ */
void dfs_detach(struct wlan_dfs *dfs); void dfs_detach(struct wlan_dfs *dfs);
#ifdef QCA_SUPPORT_DFS_CAC
/** /**
* dfs_cac_valid_reset() - Cancels the dfs_cac_valid_timer timer. * dfs_stacac_stop() - Clear the STA CAC timer.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.
* @prevchan_ieee: Prevchan number.
* @prevchan_flags: Prevchan flags.
*/ */
#ifdef CONFIG_CHAN_NUM_API void dfs_stacac_stop(struct wlan_dfs *dfs);
void dfs_cac_valid_reset(struct wlan_dfs *dfs,
uint8_t prevchan_ieee,
uint32_t prevchan_flags);
#endif
/** /**
* dfs_cac_valid_reset_for_freq() - Cancels the dfs_cac_valid_timer timer. * dfs_is_cac_required() - Check if DFS CAC is required for the current channel.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.
* @prevchan_chan: Prevchan frequency * @cur_chan: Pointer to current channel of dfs_channel structure.
* @prevchan_flags: Prevchan flags. * @prev_chan: Pointer to previous channel of dfs_channel structure.
* @continue_current_cac: If AP can start CAC then this variable indicates
* whether to continue with the current CAC or restart the CAC. This variable
* is valid only if this function returns true.
*
* Return: true if AP requires CAC or can continue current CAC, else false.
*/ */
#ifdef CONFIG_CHAN_FREQ_API bool dfs_is_cac_required(struct wlan_dfs *dfs,
void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs, struct dfs_channel *cur_chan,
uint16_t prevchan_freq, struct dfs_channel *prev_chan,
uint32_t prevchan_flags); bool *continue_current_cac);
#endif
/** /**
* dfs_cac_stop() - Clear the AP CAC timer. * dfs_cac_stop() - Clear the AP CAC timer.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.
*/ */
void dfs_cac_stop(struct wlan_dfs *dfs); void dfs_cac_stop(struct wlan_dfs *dfs);
/** /**
@@ -2202,6 +2202,131 @@ void dfs_cancel_cac_timer(struct wlan_dfs *dfs);
*/ */
void dfs_start_cac_timer(struct wlan_dfs *dfs); void dfs_start_cac_timer(struct wlan_dfs *dfs);
/**
* dfs_cac_valid_reset_for_freq() - Cancels the dfs_cac_valid_timer timer.
* @dfs: Pointer to wlan_dfs structure.
* @prevchan_chan: Prevchan frequency
* @prevchan_flags: Prevchan flags.
*/
#ifdef CONFIG_CHAN_FREQ_API
void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs,
uint16_t prevchan_freq,
uint32_t prevchan_flags);
#endif
/**
* dfs_get_override_cac_timeout() - Get override CAC timeout value.
* @dfs: Pointer to DFS object.
* @cac_timeout: Pointer to save the CAC timeout value.
*/
int dfs_get_override_cac_timeout(struct wlan_dfs *dfs,
int *cac_timeout);
/**
* dfs_override_cac_timeout() - Override the default CAC timeout.
* @dfs: Pointer to DFS object.
* @cac_timeout: CAC timeout value.
*/
int dfs_override_cac_timeout(struct wlan_dfs *dfs,
int cac_timeout);
/**
* dfs_is_ap_cac_timer_running() - Returns the dfs cac timer.
* @dfs: Pointer to wlan_dfs structure.
*/
int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs);
/**
* dfs_cac_timer_attach() - Initialize cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_attach(struct wlan_dfs *dfs);
/**
* dfs_cac_timer_reset() - Cancel dfs cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_reset(struct wlan_dfs *dfs);
/**
* dfs_cac_timer_detach() - Free dfs cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_detach(struct wlan_dfs *dfs);
#else
static inline
void dfs_stacac_stop(struct wlan_dfs *dfs)
{
}
static inline
bool dfs_is_cac_required(struct wlan_dfs *dfs,
struct dfs_channel *cur_chan,
struct dfs_channel *prev_chan,
bool *continue_current_cac)
{
return false;
}
static inline
void dfs_cac_stop(struct wlan_dfs *dfs)
{
}
static inline
void dfs_cancel_cac_timer(struct wlan_dfs *dfs)
{
}
static inline
void dfs_start_cac_timer(struct wlan_dfs *dfs)
{
}
#ifdef CONFIG_CHAN_FREQ_API
static inline
void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs,
uint16_t prevchan_freq,
uint32_t prevchan_flags)
{
}
#endif
static inline
int dfs_get_override_cac_timeout(struct wlan_dfs *dfs,
int *cac_timeout)
{
return 0;
}
static inline
int dfs_override_cac_timeout(struct wlan_dfs *dfs,
int cac_timeout)
{
return 0;
}
static inline
int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs)
{
return 0;
}
static inline
void dfs_cac_timer_attach(struct wlan_dfs *dfs)
{
}
static inline
void dfs_cac_timer_reset(struct wlan_dfs *dfs)
{
}
static inline
void dfs_cac_timer_detach(struct wlan_dfs *dfs)
{
}
#endif
/** /**
* dfs_set_update_nol_flag() - Sets update_nol flag. * dfs_set_update_nol_flag() - Sets update_nol flag.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.
@@ -2228,12 +2353,6 @@ int dfs_get_use_nol(struct wlan_dfs *dfs);
*/ */
int dfs_get_nol_timeout(struct wlan_dfs *dfs); int dfs_get_nol_timeout(struct wlan_dfs *dfs);
/**
* dfs_is_ap_cac_timer_running() - Returns the dfs cac timer.
* @dfs: Pointer to wlan_dfs structure.
*/
int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs);
/** /**
* dfs_control()- Used to process ioctls related to DFS. * dfs_control()- Used to process ioctls related to DFS.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.
@@ -2258,22 +2377,6 @@ int dfs_control(struct wlan_dfs *dfs,
void dfs_getnol(struct wlan_dfs *dfs, void dfs_getnol(struct wlan_dfs *dfs,
void *dfs_nolinfo); void *dfs_nolinfo);
/**
* dfs_get_override_cac_timeout() - Get override CAC timeout value.
* @dfs: Pointer to DFS object.
* @cac_timeout: Pointer to save the CAC timeout value.
*/
int dfs_get_override_cac_timeout(struct wlan_dfs *dfs,
int *cac_timeout);
/**
* dfs_override_cac_timeout() - Override the default CAC timeout.
* @dfs: Pointer to DFS object.
* @cac_timeout: CAC timeout value.
*/
int dfs_override_cac_timeout(struct wlan_dfs *dfs,
int cac_timeout);
/** /**
* dfs_clear_nolhistory() - unmarks WLAN_CHAN_CLR_HISTORY_RADAR flag for * dfs_clear_nolhistory() - unmarks WLAN_CHAN_CLR_HISTORY_RADAR flag for
* all the channels in dfs_ch_channels. * all the channels in dfs_ch_channels.
@@ -2344,23 +2447,6 @@ static inline int dfs_radar_disable(struct wlan_dfs *dfs)
int dfs_get_debug_info(struct wlan_dfs *dfs, int dfs_get_debug_info(struct wlan_dfs *dfs,
void *data); void *data);
/**
* dfs_cac_timer_attach() - Initialize cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_attach(struct wlan_dfs *dfs);
/**
* dfs_cac_timer_reset() - Cancel dfs cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_reset(struct wlan_dfs *dfs);
/**
* dfs_cac_timer_detach() - Free dfs cac timers.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_cac_timer_detach(struct wlan_dfs *dfs);
/** /**
* dfs_nol_timer_init() - Initialize NOL timers. * dfs_nol_timer_init() - Initialize NOL timers.
@@ -2386,12 +2472,6 @@ void dfs_nol_detach(struct wlan_dfs *dfs);
*/ */
void dfs_print_nolhistory(struct wlan_dfs *dfs); void dfs_print_nolhistory(struct wlan_dfs *dfs);
/**
* dfs_stacac_stop() - Clear the STA CAC timer.
* @dfs: Pointer to wlan_dfs structure.
*/
void dfs_stacac_stop(struct wlan_dfs *dfs);
/** /**
* dfs_find_precac_secondary_vht80_chan() - Get a VHT80 channel with the * dfs_find_precac_secondary_vht80_chan() - Get a VHT80 channel with the
* precac primary center frequency. * precac primary center frequency.
@@ -2822,22 +2902,6 @@ bool dfs_process_nol_ie_bitmap(struct wlan_dfs *dfs, uint8_t nol_ie_bandwidth,
} }
#endif #endif
/**
* dfs_is_cac_required() - Check if DFS CAC is required for the current channel.
* @dfs: Pointer to wlan_dfs structure.
* @cur_chan: Pointer to current channel of dfs_channel structure.
* @prev_chan: Pointer to previous channel of dfs_channel structure.
* @continue_current_cac: If AP can start CAC then this variable indicates
* whether to continue with the current CAC or restart the CAC. This variable
* is valid only if this function returns true.
*
* Return: true if AP requires CAC or can continue current CAC, else false.
*/
bool dfs_is_cac_required(struct wlan_dfs *dfs,
struct dfs_channel *cur_chan,
struct dfs_channel *prev_chan,
bool *continue_current_cac);
/** /**
* dfs_task_testtimer_reset() - stop dfs test timer. * dfs_task_testtimer_reset() - stop dfs test timer.
* @dfs: Pointer to wlan_dfs structure. * @dfs: Pointer to wlan_dfs structure.

View File

@@ -41,64 +41,6 @@
#define CH100_START_FREQ 5490 #define CH100_START_FREQ 5490
#define CH100 100 #define CH100 100
int dfs_override_cac_timeout(struct wlan_dfs *dfs, int cac_timeout)
{
if (!dfs)
return -EIO;
dfs->dfs_cac_timeout_override = cac_timeout;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "CAC timeout is now %s %d",
(cac_timeout == -1) ? "default" : "overridden",
cac_timeout);
return 0;
}
int dfs_get_override_cac_timeout(struct wlan_dfs *dfs, int *cac_timeout)
{
if (!dfs)
return -EIO;
(*cac_timeout) = dfs->dfs_cac_timeout_override;
return 0;
}
#ifdef CONFIG_CHAN_NUM_API
void dfs_cac_valid_reset(struct wlan_dfs *dfs,
uint8_t prevchan_ieee,
uint32_t prevchan_flags)
{
if (dfs->dfs_cac_valid_time) {
if ((prevchan_ieee != dfs->dfs_curchan->dfs_ch_ieee) ||
(prevchan_flags != dfs->dfs_curchan->dfs_ch_flags)) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Cancelling timer & clearing cac_valid"
);
qdf_timer_stop(&dfs->dfs_cac_valid_timer);
dfs->dfs_cac_valid = 0;
}
}
}
#endif
#ifdef CONFIG_CHAN_FREQ_API
void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs,
uint16_t prevchan_freq,
uint32_t prevchan_flags)
{
if (dfs->dfs_cac_valid_time) {
if ((prevchan_freq != dfs->dfs_curchan->dfs_ch_freq) ||
(prevchan_flags != dfs->dfs_curchan->dfs_ch_flags)) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Cancelling timer & clearing cac_valid");
qdf_timer_stop(&dfs->dfs_cac_valid_timer);
dfs->dfs_cac_valid = 0;
}
}
}
#endif
/** /**
* dfs_cac_valid_timeout() - Timeout function for dfs_cac_valid_timer * dfs_cac_valid_timeout() - Timeout function for dfs_cac_valid_timer
* cac_valid bit will be reset in this function. * cac_valid bit will be reset in this function.
@@ -283,6 +225,7 @@ static os_timer_func(dfs_cac_timeout)
#endif #endif
#endif #endif
#ifdef QCA_SUPPORT_DFS_CAC
void dfs_cac_timer_attach(struct wlan_dfs *dfs) void dfs_cac_timer_attach(struct wlan_dfs *dfs)
{ {
dfs->dfs_cac_timeout_override = -1; dfs->dfs_cac_timeout_override = -1;
@@ -344,30 +287,6 @@ void dfs_start_cac_timer(struct wlan_dfs *dfs)
qdf_timer_mod(&dfs->dfs_cac_timer, cac_timeout * 1000); qdf_timer_mod(&dfs->dfs_cac_timer, cac_timeout * 1000);
dfs->dfs_cac_aborted = 0; dfs->dfs_cac_aborted = 0;
} }
#else
#ifdef CONFIG_CHAN_NUM_API
void dfs_start_cac_timer(struct wlan_dfs *dfs)
{
int cac_timeout = 0;
struct dfs_channel *chan = dfs->dfs_curchan;
cac_timeout = dfs_mlme_get_cac_timeout(dfs->dfs_pdev_obj,
chan->dfs_ch_freq,
chan->dfs_ch_vhtop_ch_freq_seg2,
chan->dfs_ch_flags);
dfs->dfs_cac_started_chan = *chan;
dfs_debug(dfs, WLAN_DEBUG_DFS,
"chan = %d cfreq2 = %d timeout = %d sec, curr_time = %d sec",
chan->dfs_ch_ieee, chan->dfs_ch_vhtop_ch_freq_seg2,
cac_timeout,
qdf_system_ticks_to_msecs(qdf_system_ticks()) / 1000);
qdf_timer_mod(&dfs->dfs_cac_timer, cac_timeout * 1000);
dfs->dfs_cac_aborted = 0;
}
#endif
#endif #endif
void dfs_cancel_cac_timer(struct wlan_dfs *dfs) void dfs_cancel_cac_timer(struct wlan_dfs *dfs)
@@ -402,6 +321,47 @@ void dfs_stacac_stop(struct wlan_dfs *dfs)
dfs_clear_cac_started_chan(dfs); dfs_clear_cac_started_chan(dfs);
} }
int dfs_override_cac_timeout(struct wlan_dfs *dfs, int cac_timeout)
{
if (!dfs)
return -EIO;
dfs->dfs_cac_timeout_override = cac_timeout;
dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "CAC timeout is now %s %d",
(cac_timeout == -1) ? "default" : "overridden",
cac_timeout);
return 0;
}
int dfs_get_override_cac_timeout(struct wlan_dfs *dfs, int *cac_timeout)
{
if (!dfs)
return -EIO;
(*cac_timeout) = dfs->dfs_cac_timeout_override;
return 0;
}
#ifdef CONFIG_CHAN_FREQ_API
void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs,
uint16_t prevchan_freq,
uint32_t prevchan_flags)
{
if (dfs->dfs_cac_valid_time) {
if ((prevchan_freq != dfs->dfs_curchan->dfs_ch_freq) ||
(prevchan_flags != dfs->dfs_curchan->dfs_ch_flags)) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
"Cancelling timer & clearing cac_valid");
qdf_timer_stop(&dfs->dfs_cac_valid_timer);
dfs->dfs_cac_valid = 0;
}
}
}
#endif
#endif
/* /*
* dfs_is_subset_channel_for_freq() - Find out if prev channel and current * dfs_is_subset_channel_for_freq() - Find out if prev channel and current
* channel are subsets of each other. * channel are subsets of each other.
@@ -506,6 +466,7 @@ dfs_is_new_chan_subset_of_old_chan(struct wlan_dfs *dfs,
} }
#endif #endif
#ifdef QCA_SUPPORT_DFS_CAC
bool dfs_is_cac_required(struct wlan_dfs *dfs, bool dfs_is_cac_required(struct wlan_dfs *dfs,
struct dfs_channel *cur_chan, struct dfs_channel *cur_chan,
struct dfs_channel *prev_chan, struct dfs_channel *prev_chan,
@@ -580,3 +541,4 @@ bool dfs_is_cac_required(struct wlan_dfs *dfs,
return true; return true;
} }
#endif

View File

@@ -71,24 +71,6 @@ bool utils_dfs_is_freq_in_nol(struct wlan_objmgr_pdev *pdev, uint32_t freq)
return dfs_is_freq_in_nol(dfs, freq); return dfs_is_freq_in_nol(dfs, freq);
} }
#ifdef CONFIG_CHAN_NUM_API
QDF_STATUS utils_dfs_cac_valid_reset(struct wlan_objmgr_pdev *pdev,
uint8_t prevchan_ieee,
uint32_t prevchan_flags)
{
struct wlan_dfs *dfs;
dfs = wlan_pdev_get_dfs_obj(pdev);
if (!dfs)
return QDF_STATUS_E_FAILURE;
dfs_cac_valid_reset(dfs, prevchan_ieee, prevchan_flags);
return QDF_STATUS_SUCCESS;
}
qdf_export_symbol(utils_dfs_cac_valid_reset);
#endif
#ifdef CONFIG_CHAN_FREQ_API #ifdef CONFIG_CHAN_FREQ_API
QDF_STATUS utils_dfs_cac_valid_reset_for_freq(struct wlan_objmgr_pdev *pdev, QDF_STATUS utils_dfs_cac_valid_reset_for_freq(struct wlan_objmgr_pdev *pdev,
uint16_t prevchan_freq, uint16_t prevchan_freq,