Merge "qcacmn: Create NOL and CAC HRtimer in softIRQ context by using hrt_mode"

This commit is contained in:
Linux Build Service Account
2022-09-27 12:53:33 -07:00
committed by Gerrit - the friendly Code Review server
4 changed files with 33 additions and 80 deletions

View File

@@ -76,8 +76,12 @@ static inline
void __qdf_hrtimer_start(__qdf_hrtimer_data_t *timer, ktime_t interval, void __qdf_hrtimer_start(__qdf_hrtimer_data_t *timer, ktime_t interval,
enum qdf_hrtimer_mode mode) enum qdf_hrtimer_mode mode)
{ {
enum hrtimer_mode hrt_mode = __qdf_hrtimer_get_mode(mode); enum hrtimer_mode hrt_mode;
if (timer->ctx == QDF_CONTEXT_TASKLET)
mode |= HRTIMER_MODE_SOFT;
hrt_mode = __qdf_hrtimer_get_mode(mode);
hrtimer_start(&timer->u.hrtimer, interval, hrt_mode); hrtimer_start(&timer->u.hrtimer, interval, hrt_mode);
} }
#else #else
@@ -107,10 +111,7 @@ void __qdf_hrtimer_start(__qdf_hrtimer_data_t *timer, ktime_t interval,
static inline static inline
int __qdf_hrtimer_cancel(__qdf_hrtimer_data_t *timer) int __qdf_hrtimer_cancel(__qdf_hrtimer_data_t *timer)
{ {
if (timer->ctx == QDF_CONTEXT_HARDWARE) return hrtimer_cancel(&timer->u.hrtimer);
return hrtimer_cancel(&timer->u.hrtimer);
return 0;
} }
#else #else
static inline static inline
@@ -152,18 +153,18 @@ static inline void __qdf_hrtimer_init(__qdf_hrtimer_data_t *timer,
enum qdf_context_mode ctx) enum qdf_context_mode ctx)
{ {
struct hrtimer *hrtimer = &timer->u.hrtimer; struct hrtimer *hrtimer = &timer->u.hrtimer;
enum hrtimer_mode hrt_mode = __qdf_hrtimer_get_mode(mode); enum hrtimer_mode hrt_mode;
timer->ctx = ctx; timer->ctx = ctx;
timer->callback = cback; timer->callback = cback;
timer->cb_ctx = timer; timer->cb_ctx = timer;
if (timer->ctx == QDF_CONTEXT_HARDWARE) { if (timer->ctx == QDF_CONTEXT_TASKLET)
hrtimer_init(hrtimer, clock, hrt_mode); mode |= HRTIMER_MODE_SOFT;
hrtimer->function = __qdf_hrtimer_cb;
} else if (timer->ctx == QDF_CONTEXT_TASKLET) { hrt_mode = __qdf_hrtimer_get_mode(mode);
QDF_BUG(0); hrtimer_init(hrtimer, clock, hrt_mode);
} hrtimer->function = __qdf_hrtimer_cb;
} }
#else #else
static inline void __qdf_hrtimer_init(__qdf_hrtimer_data_t *timer, static inline void __qdf_hrtimer_init(__qdf_hrtimer_data_t *timer,

View File

@@ -765,7 +765,6 @@ struct dfs_state {
* @nol_start_us: NOL start time in us. * @nol_start_us: NOL start time in us.
* @nol_timeout_ms: NOL timeout value in msec. * @nol_timeout_ms: NOL timeout value in msec.
* @nol_timer: Per element NOL timer. * @nol_timer: Per element NOL timer.
* @nol_timer_completion_work: workqueue to process the nol timeout
* @nol_next: Next element pointer. * @nol_next: Next element pointer.
*/ */
struct dfs_nolelem { struct dfs_nolelem {
@@ -776,7 +775,6 @@ struct dfs_nolelem {
uint64_t nol_start_us; uint64_t nol_start_us;
uint32_t nol_timeout_ms; uint32_t nol_timeout_ms;
qdf_hrtimer_data_t nol_timer; qdf_hrtimer_data_t nol_timer;
qdf_work_t nol_timer_completion_work;
struct dfs_nolelem *nol_next; struct dfs_nolelem *nol_next;
}; };
@@ -1250,7 +1248,6 @@ struct wlan_dfs {
qdf_work_t dfs_nol_elem_free_work; qdf_work_t dfs_nol_elem_free_work;
qdf_hrtimer_data_t dfs_cac_timer; qdf_hrtimer_data_t dfs_cac_timer;
qdf_work_t dfs_cac_completion_work;
qdf_timer_t dfs_cac_valid_timer; qdf_timer_t dfs_cac_valid_timer;
int dfs_cac_timeout_override; int dfs_cac_timeout_override;
uint8_t dfs_enable:1, uint8_t dfs_enable:1,
@@ -1355,7 +1352,6 @@ struct wlan_dfs_priv {
* @cur_dfs_index: index of the current dfs object using the Agile Engine. * @cur_dfs_index: index of the current dfs object using the Agile Engine.
* It is used to index struct wlan_dfs_priv dfs_priv[] array. * It is used to index struct wlan_dfs_priv dfs_priv[] array.
* @dfs_precac_timer: agile precac timer * @dfs_precac_timer: agile precac timer
* @dfs_precac_completion_work: workqueue to process the precac timeout.
* @dfs_precac_timer_running: precac timer running flag * @dfs_precac_timer_running: precac timer running flag
* @ocac_status: Off channel CAC complete status * @ocac_status: Off channel CAC complete status
* @dfs_nol_ctx: dfs NOL data for all radios. * @dfs_nol_ctx: dfs NOL data for all radios.
@@ -1374,14 +1370,13 @@ struct dfs_soc_priv_obj {
uint8_t num_dfs_privs; uint8_t num_dfs_privs;
uint8_t cur_agile_dfs_index; uint8_t cur_agile_dfs_index;
qdf_hrtimer_data_t dfs_precac_timer; qdf_hrtimer_data_t dfs_precac_timer;
qdf_work_t dfs_precac_completion_work;
uint8_t dfs_precac_timer_running; uint8_t dfs_precac_timer_running;
bool precac_state_started; bool precac_state_started;
bool ocac_status; bool ocac_status;
#endif #endif
struct dfsreq_nolinfo *dfs_psoc_nolinfo; struct dfsreq_nolinfo *dfs_psoc_nolinfo;
#ifdef QCA_SUPPORT_ADFS_RCAC #ifdef QCA_SUPPORT_ADFS_RCAC
qdf_timer_t dfs_rcac_timer; qdf_hrtimer_data_t dfs_rcac_timer;
#endif #endif
#ifdef QCA_SUPPORT_AGILE_DFS #ifdef QCA_SUPPORT_AGILE_DFS
struct wlan_sm *dfs_agile_sm_hdl; struct wlan_sm *dfs_agile_sm_hdl;
@@ -2977,23 +2972,7 @@ void dfs_complete_deferred_tasks(struct wlan_dfs *dfs);
* *
* Return: void. * Return: void.
*/ */
void dfs_process_cac_completion(void *context); void dfs_process_cac_completion(struct wlan_dfs *dfs);
/**
* dfs_process_precac_completion() - Process DFS preCAC completion event.
* @dfs_soc_obj: Pointer to dfs_soc_obj object.
*
* Return: void.
*/
void dfs_process_precac_completion(void *context);
/**
* dfs_process_noltimeout_completion() - Process NOL timeout completion event.
* @dfs_nolelem: Pointer to dfs_nolelem object.
*
* Return: void.
*/
void dfs_process_noltimeout_completion(void *context);
#ifdef WLAN_DFS_TRUE_160MHZ_SUPPORT #ifdef WLAN_DFS_TRUE_160MHZ_SUPPORT
/** /**

View File

@@ -81,9 +81,8 @@ static void dfs_clear_nol_history_for_curchan(struct wlan_dfs *dfs)
num_subchs, DFS_NOL_HISTORY_RESET); num_subchs, DFS_NOL_HISTORY_RESET);
} }
void dfs_process_cac_completion(void *context) void dfs_process_cac_completion(struct wlan_dfs *dfs)
{ {
struct wlan_dfs *dfs = (struct wlan_dfs *)context;
enum phy_ch_width ch_width = CH_WIDTH_INVALID; enum phy_ch_width ch_width = CH_WIDTH_INVALID;
uint16_t primary_chan_freq = 0, sec_chan_freq = 0; uint16_t primary_chan_freq = 0, sec_chan_freq = 0;
struct dfs_channel *dfs_curchan; struct dfs_channel *dfs_curchan;
@@ -176,7 +175,7 @@ dfs_cac_timeout(qdf_hrtimer_data_t *arg)
if (dfs_is_hw_mode_switch_in_progress(dfs)) if (dfs_is_hw_mode_switch_in_progress(dfs))
dfs->dfs_defer_params.is_cac_completed = true; dfs->dfs_defer_params.is_cac_completed = true;
else else
qdf_sched_work(NULL, &dfs->dfs_cac_completion_work); dfs_process_cac_completion(dfs);
return QDF_HRTIMER_NORESTART; return QDF_HRTIMER_NORESTART;
} }
@@ -191,11 +190,7 @@ void dfs_cac_timer_attach(struct wlan_dfs *dfs)
dfs_cac_timeout, dfs_cac_timeout,
QDF_CLOCK_MONOTONIC, QDF_CLOCK_MONOTONIC,
QDF_HRTIMER_MODE_REL, QDF_HRTIMER_MODE_REL,
QDF_CONTEXT_HARDWARE); QDF_CONTEXT_TASKLET);
qdf_create_work(NULL,
&dfs->dfs_cac_completion_work,
dfs_process_cac_completion,
dfs);
qdf_timer_init(NULL, qdf_timer_init(NULL,
&(dfs->dfs_cac_valid_timer), &(dfs->dfs_cac_valid_timer),
dfs_cac_valid_timeout, dfs_cac_valid_timeout,
@@ -206,7 +201,6 @@ void dfs_cac_timer_attach(struct wlan_dfs *dfs)
void dfs_cac_timer_reset(struct wlan_dfs *dfs) void dfs_cac_timer_reset(struct wlan_dfs *dfs)
{ {
qdf_hrtimer_cancel(&dfs->dfs_cac_timer); qdf_hrtimer_cancel(&dfs->dfs_cac_timer);
qdf_flush_work(&dfs->dfs_cac_completion_work);
dfs_get_override_cac_timeout(dfs, dfs_get_override_cac_timeout(dfs,
&(dfs->dfs_cac_timeout_override)); &(dfs->dfs_cac_timeout_override));
dfs_clear_cac_started_chan(dfs); dfs_clear_cac_started_chan(dfs);
@@ -215,8 +209,6 @@ void dfs_cac_timer_reset(struct wlan_dfs *dfs)
void dfs_cac_timer_detach(struct wlan_dfs *dfs) void dfs_cac_timer_detach(struct wlan_dfs *dfs)
{ {
qdf_hrtimer_kill(&dfs->dfs_cac_timer); qdf_hrtimer_kill(&dfs->dfs_cac_timer);
qdf_flush_work(&dfs->dfs_cac_completion_work);
qdf_destroy_work(NULL, &dfs->dfs_cac_completion_work);
qdf_timer_free(&dfs->dfs_cac_valid_timer); qdf_timer_free(&dfs->dfs_cac_valid_timer);
dfs->dfs_cac_valid = 0; dfs->dfs_cac_valid = 0;
} }

View File

@@ -72,9 +72,6 @@ static void dfs_nol_elem_free_work_cb(void *context)
nolelem_list); nolelem_list);
WLAN_DFSNOL_UNLOCK(dfs); WLAN_DFSNOL_UNLOCK(dfs);
qdf_hrtimer_kill(&nol_head->nol_timer); qdf_hrtimer_kill(&nol_head->nol_timer);
qdf_flush_work(&nol_head->nol_timer_completion_work);
qdf_destroy_work(NULL,
&nol_head->nol_timer_completion_work);
qdf_mem_free(nol_head); qdf_mem_free(nol_head);
} else { } else {
WLAN_DFSNOL_UNLOCK(dfs); WLAN_DFSNOL_UNLOCK(dfs);
@@ -153,18 +150,28 @@ static void dfs_nol_delete(struct wlan_dfs *dfs,
} }
} }
void dfs_process_noltimeout_completion(void *context) /**
* dfs_remove_from_nol() - Remove the freq from NOL list.
* @arg: argument of the timer
*
* When NOL times out, this function removes the channel from NOL list.
*/
#ifdef CONFIG_CHAN_FREQ_API
static enum qdf_hrtimer_restart_status
dfs_remove_from_nol(qdf_hrtimer_data_t *arg)
{ {
struct dfs_nolelem *nol_arg;
struct wlan_dfs *dfs; struct wlan_dfs *dfs;
uint16_t delfreq; uint16_t delfreq;
uint16_t delchwidth; uint16_t delchwidth;
uint8_t chan; uint8_t chan;
struct dfs_nolelem *nol_arg;
nol_arg = (struct dfs_nolelem *)context; nol_arg = container_of(arg, struct dfs_nolelem, nol_timer);
dfs = nol_arg->nol_dfs; dfs = nol_arg->nol_dfs;
delfreq = nol_arg->nol_freq; delfreq = nol_arg->nol_freq;
delchwidth = nol_arg->nol_chwidth; delchwidth = nol_arg->nol_chwidth;
/* Delete the given NOL entry. */ /* Delete the given NOL entry. */
DFS_NOL_DELETE_CHAN_LOCKED(dfs, delfreq, delchwidth); DFS_NOL_DELETE_CHAN_LOCKED(dfs, delfreq, delchwidth);
@@ -194,7 +201,7 @@ void dfs_process_noltimeout_completion(void *context)
* of, after VAP start. * of, after VAP start.
*/ */
if (dfs_switch_to_postnol_chan_if_nol_expired(dfs)) if (dfs_switch_to_postnol_chan_if_nol_expired(dfs))
return; return QDF_HRTIMER_NORESTART;
/* /*
* If BW Expand is enabled, check if the user configured channel is * If BW Expand is enabled, check if the user configured channel is
* available. If it is available, STOP the AGILE SM and Restart the * available. If it is available, STOP the AGILE SM and Restart the
@@ -221,25 +228,6 @@ void dfs_process_noltimeout_completion(void *context)
utils_dfs_agile_sm_deliver_evt(dfs->dfs_pdev_obj, utils_dfs_agile_sm_deliver_evt(dfs->dfs_pdev_obj,
DFS_AGILE_SM_EV_AGILE_START); DFS_AGILE_SM_EV_AGILE_START);
} }
}
/**
* dfs_remove_from_nol() - Remove the freq from NOL list.
* @arg: argument of the timer
*
* When NOL times out, this function removes the channel from NOL list.
*/
#ifdef CONFIG_CHAN_FREQ_API
static enum qdf_hrtimer_restart_status
dfs_remove_from_nol(qdf_hrtimer_data_t *arg)
{
struct dfs_nolelem *nol_arg;
nol_arg = container_of(arg, struct dfs_nolelem, nol_timer);
qdf_sched_work(NULL, &nol_arg->nol_timer_completion_work);
return QDF_HRTIMER_NORESTART; return QDF_HRTIMER_NORESTART;
} }
#endif #endif
@@ -430,11 +418,7 @@ void dfs_nol_addchan(struct wlan_dfs *dfs,
qdf_hrtimer_init(&elem->nol_timer, dfs_remove_from_nol, qdf_hrtimer_init(&elem->nol_timer, dfs_remove_from_nol,
QDF_CLOCK_MONOTONIC, QDF_HRTIMER_MODE_REL, QDF_CLOCK_MONOTONIC, QDF_HRTIMER_MODE_REL,
QDF_CONTEXT_HARDWARE); QDF_CONTEXT_TASKLET);
qdf_create_work(NULL,
&elem->nol_timer_completion_work,
dfs_process_noltimeout_completion,
elem);
qdf_hrtimer_start(&elem->nol_timer, qdf_hrtimer_start(&elem->nol_timer,
qdf_time_ms_to_ktime(dfs_nol_timeout * TIME_IN_MS), qdf_time_ms_to_ktime(dfs_nol_timeout * TIME_IN_MS),
QDF_HRTIMER_MODE_REL); QDF_HRTIMER_MODE_REL);
@@ -560,9 +544,6 @@ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs)
1, 1,
DFS_NOL_RESET); DFS_NOL_RESET);
qdf_hrtimer_kill(&nol->nol_timer); qdf_hrtimer_kill(&nol->nol_timer);
qdf_flush_work(&nol->nol_timer_completion_work);
qdf_destroy_work(NULL,
&nol->nol_timer_completion_work);
qdf_mem_free(nol); qdf_mem_free(nol);
} else { } else {
WLAN_DFSNOL_UNLOCK(dfs); WLAN_DFSNOL_UNLOCK(dfs);