qcacmn: Move unsafe info to regulator msg
If two channel avoid event reported by FW back to back, flag psoc_priv_obj->ch_avoid_ind of 2nd event set by reg_process_ch_avoid_event may be modified when processing 1st event in reg_call_chan_change_cbks, from scheduler_thread context. Copy chan avoid info to message post to scheduler to avoid such timing issue. Change-Id: I8fd5e7e8f2d9b2117a5c6a54fd8b64659e10f7d6 CRs-Fixed: 3012331
This commit is contained in:

committed by
Madan Koyyalamudi

parent
cc74d108d0
commit
858a29eec9
@@ -37,9 +37,13 @@
|
||||
* change.
|
||||
* @psoc: Pointer to global psoc structure.
|
||||
* @pdev: Pointer to global pdev structure.
|
||||
* @ch_avoid_ind: if chan avoid indicated
|
||||
* @avoid_info: chan avoid info if @ch_avoid_ind is true
|
||||
*/
|
||||
static void reg_call_chan_change_cbks(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_objmgr_pdev *pdev)
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
bool ch_avoid_ind,
|
||||
struct avoid_freq_ind_data *avoid_info)
|
||||
{
|
||||
struct chan_change_cbk_entry *cbk_list;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
@@ -70,21 +74,9 @@ static void reg_call_chan_change_cbks(struct wlan_objmgr_psoc *psoc,
|
||||
NUM_CHANNELS *
|
||||
sizeof(struct regulatory_channel));
|
||||
|
||||
if (psoc_priv_obj->ch_avoid_ind) {
|
||||
avoid_freq_ind = qdf_mem_malloc(sizeof(*avoid_freq_ind));
|
||||
if (!avoid_freq_ind)
|
||||
goto skip_ch_avoid_ind;
|
||||
if (ch_avoid_ind)
|
||||
avoid_freq_ind = avoid_info;
|
||||
|
||||
qdf_mem_copy(&avoid_freq_ind->freq_list,
|
||||
&psoc_priv_obj->avoid_freq_list,
|
||||
sizeof(struct ch_avoid_ind_type));
|
||||
qdf_mem_copy(&avoid_freq_ind->chan_list,
|
||||
&psoc_priv_obj->unsafe_chan_list,
|
||||
sizeof(struct unsafe_ch_list));
|
||||
psoc_priv_obj->ch_avoid_ind = false;
|
||||
}
|
||||
|
||||
skip_ch_avoid_ind:
|
||||
cbk_list = psoc_priv_obj->cbk_list;
|
||||
|
||||
for (ctr = 0; ctr < REG_MAX_CHAN_CHANGE_CBKS; ctr++) {
|
||||
@@ -98,8 +90,6 @@ skip_ch_avoid_ind:
|
||||
cbk_list[ctr].arg);
|
||||
}
|
||||
qdf_mem_free(cur_chan_list);
|
||||
if (avoid_freq_ind)
|
||||
qdf_mem_free(avoid_freq_ind);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,10 +101,28 @@ static void reg_alloc_and_fill_payload(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
struct reg_sched_payload **payload)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
||||
psoc_priv_obj = reg_get_psoc_obj(psoc);
|
||||
if (!psoc_priv_obj) {
|
||||
reg_err("reg psoc private obj is NULL");
|
||||
*payload = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
*payload = qdf_mem_malloc(sizeof(**payload));
|
||||
if (*payload) {
|
||||
(*payload)->psoc = psoc;
|
||||
(*payload)->pdev = pdev;
|
||||
(*payload)->ch_avoid_ind = !!psoc_priv_obj->ch_avoid_ind;
|
||||
qdf_mem_copy(&(*payload)->avoid_info.freq_list,
|
||||
&psoc_priv_obj->avoid_freq_list,
|
||||
sizeof(psoc_priv_obj->avoid_freq_list));
|
||||
qdf_mem_copy(&(*payload)->avoid_info.chan_list,
|
||||
&psoc_priv_obj->unsafe_chan_list,
|
||||
sizeof(psoc_priv_obj->unsafe_chan_list));
|
||||
|
||||
psoc_priv_obj->ch_avoid_ind = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +154,8 @@ static QDF_STATUS reg_sched_chan_change_cbks_sb(struct scheduler_msg *msg)
|
||||
struct wlan_objmgr_psoc *psoc = load->psoc;
|
||||
struct wlan_objmgr_pdev *pdev = load->pdev;
|
||||
|
||||
reg_call_chan_change_cbks(psoc, pdev);
|
||||
reg_call_chan_change_cbks(psoc, pdev, load->ch_avoid_ind,
|
||||
&load->avoid_info);
|
||||
|
||||
wlan_objmgr_pdev_release_ref(pdev, WLAN_REGULATORY_SB_ID);
|
||||
wlan_objmgr_psoc_release_ref(psoc, WLAN_REGULATORY_SB_ID);
|
||||
@@ -183,7 +192,8 @@ static QDF_STATUS reg_sched_chan_change_cbks_nb(struct scheduler_msg *msg)
|
||||
struct wlan_objmgr_psoc *psoc = load->psoc;
|
||||
struct wlan_objmgr_pdev *pdev = load->pdev;
|
||||
|
||||
reg_call_chan_change_cbks(psoc, pdev);
|
||||
reg_call_chan_change_cbks(psoc, pdev, load->ch_avoid_ind,
|
||||
&load->avoid_info);
|
||||
|
||||
wlan_objmgr_pdev_release_ref(pdev, WLAN_REGULATORY_NB_ID);
|
||||
wlan_objmgr_psoc_release_ref(psoc, WLAN_REGULATORY_NB_ID);
|
||||
|
@@ -1252,16 +1252,6 @@ struct reg_freq_range {
|
||||
uint32_t high_freq;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct reg_sched_payload
|
||||
* @psoc: psoc ptr
|
||||
* @pdev: pdev ptr
|
||||
*/
|
||||
struct reg_sched_payload {
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
};
|
||||
|
||||
/**
|
||||
* enum direction
|
||||
* @NORTHBOUND: northbound
|
||||
@@ -1408,6 +1398,20 @@ struct avoid_freq_ind_data {
|
||||
struct unsafe_ch_list chan_list;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct reg_sched_payload
|
||||
* @psoc: psoc ptr
|
||||
* @pdev: pdev ptr
|
||||
* @ch_avoid_ind: if avoidance event indicated
|
||||
* @avoid_info: chan avoid info if @ch_avoid_ind is true
|
||||
*/
|
||||
struct reg_sched_payload {
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
bool ch_avoid_ind;
|
||||
struct avoid_freq_ind_data avoid_info;
|
||||
};
|
||||
|
||||
#define FIVEG_STARTING_FREQ 5000
|
||||
#define TWOG_STARTING_FREQ 2407
|
||||
#define TWOG_CHAN_14_IN_MHZ 2484
|
||||
|
Reference in New Issue
Block a user