From c5152c79045114ce3af0ba3fa75f9b25513b0898 Mon Sep 17 00:00:00 2001 From: Abhijit Pradhan Date: Thu, 29 Jun 2017 13:27:45 +0530 Subject: [PATCH 1/4] qcacmn: DFS code cleanup * Remove nif and sif keyword. * Combine nif_dfs_detach and sif_dfs_detach. * Combine nif_dfs_attach and dfs_attach. Change-Id: Ibf4638a64fac976846bfcb1eae91f3f3bb3e994e CRs-Fixed: 2071164 --- umac/dfs/core/src/dfs.h | 77 +++++++--- umac/dfs/core/src/dfs_zero_cac.h | 22 +-- .../core/src/filtering/dfs_process_phyerr.c | 2 +- umac/dfs/core/src/filtering/dfs_radar.c | 2 +- umac/dfs/core/src/misc/dfs.c | 134 +++++++++--------- umac/dfs/core/src/misc/dfs_cac.c | 134 +++++------------- umac/dfs/core/src/misc/dfs_nol.c | 111 ++++++++++++++- umac/dfs/core/src/misc/dfs_zero_cac.c | 45 +++--- umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h | 36 ----- umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h | 26 +--- .../dispatcher/src/wlan_dfs_init_deinit_api.c | 4 +- umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c | 51 ------- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 19 +-- .../lmac_if/inc/wlan_lmac_if_def.h | 8 -- .../lmac_if/src/wlan_lmac_if.c | 4 - 15 files changed, 319 insertions(+), 356 deletions(-) diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index 3bf04ed7a117..d5039719826e 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -1061,6 +1061,14 @@ void dfs_nol_update(struct wlan_dfs *dfs); */ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs); +/** + * dfs_nol_detach() - Free NOL variables. + * @dfs: Pointer to wlan_dfs structure. + * + * Cancels the NOL timer and frees the NOL elements. + */ +void dfs_nol_detach(struct wlan_dfs *dfs); + /** * dfs_retain_bin5_burst_pattern() - Retain the BIN5 burst pattern. * @dfs: Pointer to wlan_dfs structure. @@ -1406,11 +1414,17 @@ bool dfs_is_precac_timer_running(struct wlan_dfs *dfs); void dfs_get_radars(struct wlan_dfs *dfs); /** - * dfs_attach() - Allocates memory for wlan_dfs members. + * dfs_attach() - Wrapper function to allocate memory for wlan_dfs members. * @dfs: Pointer to wlan_dfs structure. */ int dfs_attach(struct wlan_dfs *dfs); +/** + * dfs_main_attach() - Allocates memory for wlan_dfs members. + * @dfs: Pointer to wlan_dfs structure. + */ +int dfs_main_attach(struct wlan_dfs *dfs); + /** * dfs_create_object() - Creates DFS object. * @dfs: Pointer to wlan_dfs structure. @@ -1423,12 +1437,6 @@ int dfs_create_object(struct wlan_dfs **dfs); */ void dfs_destroy_object(struct wlan_dfs *dfs); -/** - * nif_dfs_reset() - DFS reset. - * @dfs: Pointer to wlan_dfs structure. - */ -void nif_dfs_reset(struct wlan_dfs *dfs); - /** * dfs_random_channel() - Function to choose the random channel from the current * channel list. @@ -1442,22 +1450,16 @@ int dfs_random_channel(struct wlan_dfs *dfs, uint8_t skip_curchan); /** - * sif_dfs_detach() - DFS detach. + * dfs_detach() - Wrapper function to free dfs variables. * @dfs: Pointer to wlan_dfs structure. */ -void sif_dfs_detach(struct wlan_dfs *dfs); +void dfs_detach(struct wlan_dfs *dfs); /** - * nif_dfs_detach() - DFS detach + * dfs_main_detach() - Free dfs variables. * @dfs: Pointer to wlan_dfs structure. */ -void nif_dfs_detach(struct wlan_dfs *dfs); - -/** - * nif_dfs_attach() - DFS attach function. - * @dfs: Pointer to wlan_dfs structure. - **/ -void nif_dfs_attach(struct wlan_dfs *dfs); +void dfs_main_detach(struct wlan_dfs *dfs); /** * dfs_cac_valid_reset() - Cancels the dfs_cac_valid_timer timer. @@ -1646,6 +1648,36 @@ void dfs_mark_precac_dfs(struct wlan_dfs *dfs, int dfs_get_debug_info(struct wlan_dfs *dfs, void *data); +/** + * dfs_cac_timer_init() - Initialize cac timers. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_cac_timer_init(struct wlan_dfs *dfs); + +/** + * dfs_cac_attach() - Initialize dfs cac variables. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_cac_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_nol_timer_init() - Initialize NOL timers. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_nol_timer_init(struct wlan_dfs *dfs); + +/** + * dfs_nol_attach() - Initialize NOL variables. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_nol_attach(struct wlan_dfs *dfs); + /** * dfs_print_nolhistory() - Print NOL history. * @dfs: Pointer to wlan_dfs structure. @@ -1881,4 +1913,15 @@ void count_the_other_delay_elements(struct wlan_dfs *dfs, int fundamentalpri ); +/** + * dfs_main_timer_init() - Initialize dfs timers. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_main_timer_init(struct wlan_dfs *dfs); + +/** + * dfs_main_timer_reset() - Stop dfs timers. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_main_timer_reset(struct wlan_dfs *dfs); #endif /* _DFS_H_ */ diff --git a/umac/dfs/core/src/dfs_zero_cac.h b/umac/dfs/core/src/dfs_zero_cac.h index e72929921979..8c16a111a601 100644 --- a/umac/dfs/core/src/dfs_zero_cac.h +++ b/umac/dfs/core/src/dfs_zero_cac.h @@ -53,6 +53,12 @@ struct dfs_precac_entry { struct wlan_dfs *dfs; }; +/** + * dfs_zero_cac_timer_init() - Initialize zero-cac timers + * @dfs: Pointer to DFS structure. + */ +void dfs_zero_cac_timer_init(struct wlan_dfs *dfs); + /** * dfs_print_precaclists() - Print precac list. * @dfs: Pointer to wlan_dfs structure. @@ -79,6 +85,12 @@ void dfs_reset_precaclists(struct wlan_dfs *dfs); */ void dfs_deinit_precac_list(struct wlan_dfs *dfs); +/** + * dfs_zero_cac_detach() - Free zero_cac memory. + * @dfs: Pointer to wlan_dfs dtructure. + */ +void dfs_zero_cac_detach(struct wlan_dfs *dfs); + /** * dfs_init_precac_list() - Init precac list. * @dfs: Pointer to wlan_dfs dtructure. @@ -100,8 +112,8 @@ void dfs_start_precac_timer(struct wlan_dfs *dfs, void dfs_cancel_precac_timer(struct wlan_dfs *dfs); /** - * dfs_zero_cac_attach() - Initializes Zero cac DFS variables. - * @dfs: Pointer to wlan_dfs structure. + * dfs_zero_cac_attach() - Initialize dfs zerocac variables. + * @dfs: Pointer to DFS structure. */ void dfs_zero_cac_attach(struct wlan_dfs *dfs); @@ -207,12 +219,6 @@ uint32_t dfs_get_precac_enable(struct wlan_dfs *dfs); */ void dfs_zero_cac_reset(struct wlan_dfs *dfs); -/** - * dfs_zero_cac_attach() - Initializes Zero cac DFS variables. - * @dfs: Pointer to wlan_dfs structure. - */ -void dfs_zero_cac_attach(struct wlan_dfs *dfs); - /** * dfs_is_ht20_40_80_chan_in_precac_done_list() - Is precac done on a * VHT20/40/80 channel. diff --git a/umac/dfs/core/src/filtering/dfs_process_phyerr.c b/umac/dfs/core/src/filtering/dfs_process_phyerr.c index f47101e6c531..feb2d2876fc9 100644 --- a/umac/dfs/core/src/filtering/dfs_process_phyerr.c +++ b/umac/dfs/core/src/filtering/dfs_process_phyerr.c @@ -810,7 +810,7 @@ void dfs_process_phyerr(struct wlan_dfs *dfs, void *buf, uint16_t datalen, } if (!STAILQ_EMPTY(&dfs->dfs_radarq) && !dfs->wlan_radar_tasksched) { dfs->wlan_radar_tasksched = 1; - OS_SET_TIMER(&dfs->wlan_dfs_task_timer, 0); + qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0); } #undef EXT_CH_RADAR_FOUND #undef PRI_CH_RADAR_FOUND diff --git a/umac/dfs/core/src/filtering/dfs_radar.c b/umac/dfs/core/src/filtering/dfs_radar.c index 50a12da115af..08132852deb0 100644 --- a/umac/dfs/core/src/filtering/dfs_radar.c +++ b/umac/dfs/core/src/filtering/dfs_radar.c @@ -563,7 +563,7 @@ void dfs_radar_found_action(struct wlan_dfs *dfs) dfs->wlan_dfstest = 1; dfs->wlan_dfstest_ieeechan = dfs->dfs_curchan->dfs_ch_ieee; dfs->wlan_dfstesttime = 1; /* 1ms */ - OS_SET_TIMER(&dfs->wlan_dfstesttimer, + qdf_timer_mod(&dfs->wlan_dfstesttimer, dfs->wlan_dfstesttime); } diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index e3cfbf61ea19..683f79012924 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -94,6 +94,21 @@ int dfs_get_debug_info(struct wlan_dfs *dfs, void *data) return (int)dfs->dfs_proc_phyerr; } +void dfs_main_timer_init(struct wlan_dfs *dfs) +{ + qdf_timer_init(NULL, + &(dfs->wlan_dfs_task_timer), + dfs_task, + (void *)(dfs), + QDF_TIMER_TYPE_WAKE_APPS); + + qdf_timer_init(NULL, + &(dfs->wlan_dfstesttimer), + dfs_testtimer_task, + (void *)dfs, + QDF_TIMER_TYPE_WAKE_APPS); +} + int dfs_create_object(struct wlan_dfs **dfs) { *dfs = (struct wlan_dfs *)qdf_mem_malloc(sizeof(**dfs)); @@ -115,7 +130,7 @@ int dfs_create_object(struct wlan_dfs **dfs) return 0; } -int dfs_attach(struct wlan_dfs *dfs) +int dfs_main_attach(struct wlan_dfs *dfs) { int i, n; struct wlan_dfs_radar_tab_info radar_info; @@ -170,18 +185,11 @@ int dfs_attach(struct wlan_dfs *dfs) dfs->dfs_event_log_on = 1; DFS_PRINTK("%s: event log enabled by default\n", __func__); + dfs->dfs_enable = 1; + /*Verify : Passing NULL to qdf_timer_init().*/ - qdf_timer_init(NULL, - &(dfs->wlan_dfs_task_timer), - dfs_task, - (void *)(dfs), - QDF_TIMER_TYPE_WAKE_APPS); - qdf_timer_init(NULL, - &(dfs->wlan_dfstesttimer), - dfs_testtimer_task, - (void *)dfs, - QDF_TIMER_TYPE_WAKE_APPS); - dfs->wlan_dfs_cac_time = WLAN_DFS_WAIT_MS; + dfs_main_timer_init(dfs); + WLAN_DFSQ_LOCK_INIT(dfs); STAILQ_INIT(&dfs->dfs_radarq); WLAN_ARQ_LOCK_INIT(dfs); @@ -303,6 +311,34 @@ bad1: return 1; } +int dfs_attach(struct wlan_dfs *dfs) +{ + int ret; + + ret = dfs_main_attach(dfs); + if (ret) + return ret; + + dfs_cac_attach(dfs); + dfs_zero_cac_attach(dfs); + dfs_nol_attach(dfs); + + return 0; +} + +void dfs_main_timer_reset(struct wlan_dfs *dfs) +{ + if (dfs->wlan_radar_tasksched) { + qdf_timer_stop(&dfs->wlan_dfs_task_timer); + dfs->wlan_radar_tasksched = 0; + } + + if (dfs->wlan_dfstest) { + qdf_timer_stop(&dfs->wlan_dfstesttimer); + dfs->wlan_dfstest = 0; + } +} + void dfs_reset(struct wlan_dfs *dfs) { if (dfs == NULL) { @@ -311,45 +347,28 @@ void dfs_reset(struct wlan_dfs *dfs) return; } - if (dfs->wlan_radar_tasksched) { - qdf_timer_stop(&dfs->wlan_dfs_task_timer); - dfs->wlan_radar_tasksched = 0; - } - - if (dfs->wlan_dfstest) { - qdf_timer_stop(&dfs->wlan_dfstesttimer); - dfs->wlan_dfstest = 0; - } + dfs_cac_timer_reset(dfs); + dfs_zero_cac_reset(dfs); + dfs_main_timer_reset(dfs); dfs_nol_timer_cleanup(dfs); dfs_clear_nolhistory(dfs); } -void sif_dfs_detach(struct wlan_dfs *dfs) +void dfs_main_detach(struct wlan_dfs *dfs) { int n, empty; - if (dfs == NULL) { - DFS_DPRINTK(dfs, WLAN_DEBUG_DFS1, - "%s: dfs is NULL\n", __func__); + if (!dfs->dfs_enable) return; - } + + dfs->dfs_enable = 0; if (dfs->dfs_curchan != NULL) { - OS_FREE(dfs->dfs_curchan); + qdf_mem_free(dfs->dfs_curchan); dfs->dfs_curchan = NULL; } - if (dfs->wlan_radar_tasksched) { - qdf_timer_stop(&dfs->wlan_dfs_task_timer); - dfs->wlan_radar_tasksched = 0; - } - - if (dfs->wlan_dfstest) { - qdf_timer_stop(&dfs->wlan_dfstesttimer); - dfs->wlan_dfstest = 0; - } - dfs_reset_radarq(dfs); dfs_reset_alldelaylines(dfs); @@ -394,7 +413,13 @@ void sif_dfs_detach(struct wlan_dfs *dfs) qdf_mem_free(dfs->events); dfs->events = NULL; } - dfs_nol_timer_cleanup(dfs); +} + +void dfs_detach(struct wlan_dfs *dfs) +{ + dfs_main_detach(dfs); + dfs_zero_cac_detach(dfs); + dfs_nol_detach(dfs); } void dfs_destroy_object(struct wlan_dfs *dfs) @@ -894,7 +919,7 @@ int dfs_control(struct wlan_dfs *dfs, case DFS_BANGRADAR: dfs->dfs_bangradar = 1; dfs->wlan_radar_tasksched = 1; - OS_SET_TIMER(&dfs->wlan_dfs_task_timer, 0); + qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0); error = 0; break; case DFS_SHOW_PRECAC_LISTS: @@ -906,7 +931,7 @@ int dfs_control(struct wlan_dfs *dfs, case DFS_SECOND_SEGMENT_BANGRADAR: dfs->dfs_second_segment_bangradar = 1; dfs->wlan_radar_tasksched = 1; - OS_SET_TIMER(&dfs->wlan_dfs_task_timer, 0); + qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0); error = 0; break; default: @@ -1024,35 +1049,6 @@ int dfs_get_thresholds(struct wlan_dfs *dfs, return 1; } -void dfs_getnol(struct wlan_dfs *dfs, void *dfs_nolinfo) -{ - struct dfsreq_nolinfo *nolinfo = (struct dfsreq_nolinfo *)dfs_nolinfo; - - dfs_get_nol(dfs, nolinfo->dfs_nol, &(nolinfo->dfs_ch_nchans)); -} - -void dfs_clear_nolhistory(struct wlan_dfs *dfs) -{ - /* We should have a dfs_clear_nolhistory API from Regdomain. */ - struct dfs_ieee80211_channel *c, lc; - int i; - int nchans = 0; - - c = &lc; - dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans); - for (i = 0; i < nchans; i++) { - dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj, - &(c->dfs_ch_freq), - &(c->dfs_ch_flags), - &(c->dfs_ch_flagext), - &(c->dfs_ch_ieee), - &(c->dfs_ch_vhtop_ch_freq_seg1), - &(c->dfs_ch_vhtop_ch_freq_seg2), - i); - IEEE80211_CHAN_CLR_HISTORY_RADAR(c); - } -} - void dfs_set_current_channel(struct wlan_dfs *dfs, uint16_t dfs_ch_freq, uint32_t dfs_ch_flags, diff --git a/umac/dfs/core/src/misc/dfs_cac.c b/umac/dfs/core/src/misc/dfs_cac.c index ca71e9b6e2a8..14dba0d8a095 100644 --- a/umac/dfs/core/src/misc/dfs_cac.c +++ b/umac/dfs/core/src/misc/dfs_cac.c @@ -34,8 +34,6 @@ #include "wlan_dfs_mlme_api.h" #include "../dfs_internal.h" -static int ieee80211_nol_timeout = 30*60; /* 30 minutes */ -#define NOL_TIMEOUT (ieee80211_nol_timeout*1000) #define IS_CHANNEL_WEATHER_RADAR(freq) ((freq >= 5600) && (freq <= 5650)) #define ADJACENT_WEATHER_RADAR_CHANNEL 5580 #define CH100_START_FREQ 5490 @@ -64,23 +62,6 @@ int dfs_get_override_cac_timeout(struct wlan_dfs *dfs, int *cac_timeout) return 0; } -void nif_dfs_detach(struct wlan_dfs *dfs) -{ - if (!dfs->dfs_enable) - return; - - dfs->dfs_enable = 0; - nif_dfs_reset(dfs); - dfs_deinit_precac_list(dfs); -} - -void nif_dfs_reset(struct wlan_dfs *dfs) -{ - qdf_timer_stop(&dfs->dfs_cac_timer); - dfs->dfs_cac_timeout_override = -1; - dfs_zero_cac_reset(dfs); -} - void dfs_cac_valid_reset(struct wlan_dfs *dfs, uint8_t prevchan_ieee, uint32_t prevchan_flags) @@ -167,7 +148,7 @@ static os_timer_func(dfs_cac_timeout) */ if (dfs->dfs_cac_valid_time) { dfs->dfs_cac_valid = 1; - OS_SET_TIMER(&dfs->dfs_cac_valid_timer, + qdf_timer_mod(&dfs->dfs_cac_valid_timer, dfs->dfs_cac_valid_time * 1000); } } @@ -184,6 +165,36 @@ static os_timer_func(dfs_cac_timeout) } } +void dfs_cac_timer_init(struct wlan_dfs *dfs) +{ + qdf_timer_init(NULL, + &(dfs->dfs_cac_timer), + dfs_cac_timeout, + (void *)(dfs), + QDF_TIMER_TYPE_WAKE_APPS); + + qdf_timer_init(NULL, + &(dfs->dfs_cac_valid_timer), + dfs_cac_valid_timeout, + (void *)(dfs), + QDF_TIMER_TYPE_WAKE_APPS); +} + +void dfs_cac_attach(struct wlan_dfs *dfs) +{ + dfs->dfs_cac_timeout_override = -1; + dfs->wlan_dfs_cac_time = WLAN_DFS_WAIT_MS; + dfs_cac_timer_init(dfs); +} + +void dfs_cac_timer_reset(struct wlan_dfs *dfs) +{ + qdf_timer_stop(&dfs->dfs_cac_timer); + dfs_get_override_cac_timeout(dfs, + &(dfs->dfs_cac_timeout_override)); + +} + int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs) { return dfs->dfs_cac_timer_running; @@ -191,7 +202,7 @@ int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs) void dfs_start_cac_timer(struct wlan_dfs *dfs) { - OS_SET_TIMER(&dfs->dfs_cac_timer, + qdf_timer_mod(&dfs->dfs_cac_timer, dfs_mlme_get_cac_timeout(dfs->dfs_pdev_obj, dfs->dfs_curchan->dfs_ch_freq, dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg2, @@ -225,87 +236,6 @@ void dfs_stacac_stop(struct wlan_dfs *dfs) __func__, dfs->dfs_curchan->dfs_ch_freq, phyerr); } -/** - * dfs_nol_timeout() - NOL timeout function. - * - * Clears the IEEE80211_CHAN_DFS_RADAR_FOUND flag for the NOL timeout channel. - */ -static os_timer_func(dfs_nol_timeout) -{ - struct dfs_ieee80211_channel *c = NULL, lc; - unsigned long oldest, now; - struct wlan_dfs *dfs = NULL; - int i; - int nchans = 0; - - c = &lc; - - OS_GET_TIMER_ARG(dfs, struct wlan_dfs *); - dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans); - - now = oldest = qdf_system_ticks(); - for (i = 0; i < nchans; i++) { - dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj, - &(c->dfs_ch_freq), - &(c->dfs_ch_flags), - &(c->dfs_ch_flagext), - &(c->dfs_ch_ieee), - &(c->dfs_ch_vhtop_ch_freq_seg1), - &(c->dfs_ch_vhtop_ch_freq_seg2), - i); - if (IEEE80211_IS_CHAN_RADAR(c)) { - if (qdf_system_time_after_eq(now, - dfs->dfs_nol_event[i] + NOL_TIMEOUT)) { - c->dfs_ch_flagext &= - ~IEEE80211_CHAN_DFS_RADAR_FOUND; - if (c->dfs_ch_flags & - IEEE80211_CHAN_DFS_RADAR) { - /* - * NB: do this here so we get only one - * msg instead of one for every channel - * table entry. - */ - DFS_DPRINTK(dfs, WLAN_DEBUG_DFS, - "%s : radar on channel %u (%u MHz) cleared after timeout\n", - __func__, - c->dfs_ch_ieee, - c->dfs_ch_freq); - } - } else if (dfs->dfs_nol_event[i] < oldest) - oldest = dfs->dfs_nol_event[i]; - } - } - if (oldest != now) { - /* Arrange to process next channel up for a status change. */ - OS_SET_TIMER(&dfs->dfs_nol_timer, NOL_TIMEOUT - - qdf_system_ticks_to_msecs(qdf_system_ticks())); - } -} - -void nif_dfs_attach(struct wlan_dfs *dfs) -{ - dfs->dfs_enable = 1; - dfs->dfs_cac_timeout_override = -1; - dfs_zero_cac_attach(dfs); - qdf_timer_init(NULL, - &(dfs->dfs_cac_timer), - dfs_cac_timeout, - (void *)(dfs), - QDF_TIMER_TYPE_WAKE_APPS); - - qdf_timer_init(NULL, - &(dfs->dfs_nol_timer), - dfs_nol_timeout, - (void *)(dfs), - QDF_TIMER_TYPE_WAKE_APPS); - - qdf_timer_init(NULL, - &(dfs->dfs_cac_valid_timer), - dfs_cac_valid_timeout, - (void *)(dfs), - QDF_TIMER_TYPE_WAKE_APPS); -} - int dfs_random_channel(struct wlan_dfs *dfs, uint8_t is_select_nondfs, uint8_t skip_curchan) diff --git a/umac/dfs/core/src/misc/dfs_nol.c b/umac/dfs/core/src/misc/dfs_nol.c index dab7e7fd0915..870fb05e4f85 100644 --- a/umac/dfs/core/src/misc/dfs_nol.c +++ b/umac/dfs/core/src/misc/dfs_nol.c @@ -36,7 +36,78 @@ #include #include -/* for loop to traverse the channel list. */ +/** + * dfs_nol_timeout() - NOL timeout function. + * + * Clears the IEEE80211_CHAN_DFS_RADAR_FOUND flag for the NOL timeout channel. + */ +static os_timer_func(dfs_nol_timeout) +{ + struct dfs_ieee80211_channel *c = NULL, lc; + unsigned long oldest, now; + struct wlan_dfs *dfs = NULL; + int i; + int nchans = 0; + + c = &lc; + + OS_GET_TIMER_ARG(dfs, struct wlan_dfs *); + dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans); + + now = oldest = qdf_system_ticks(); + for (i = 0; i < nchans; i++) { + dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj, + &(c->dfs_ch_freq), + &(c->dfs_ch_flags), + &(c->dfs_ch_flagext), + &(c->dfs_ch_ieee), + &(c->dfs_ch_vhtop_ch_freq_seg1), + &(c->dfs_ch_vhtop_ch_freq_seg2), + i); + if (IEEE80211_IS_CHAN_RADAR(c)) { + if (qdf_system_time_after_eq(now, + dfs->dfs_nol_event[i] + + dfs_get_nol_timeout(dfs))) { + c->dfs_ch_flagext &= + ~IEEE80211_CHAN_DFS_RADAR_FOUND; + if (c->dfs_ch_flags & + IEEE80211_CHAN_DFS_RADAR) { + /* + * NB: do this here so we get only one + * msg instead of one for every channel + * table entry. + */ + DFS_DPRINTK(dfs, WLAN_DEBUG_DFS, + "%s : radar on channel %u (%u MHz) cleared after timeout\n", + __func__, + c->dfs_ch_ieee, + c->dfs_ch_freq); + } + } else if (dfs->dfs_nol_event[i] < oldest) + oldest = dfs->dfs_nol_event[i]; + } + } + if (oldest != now) { + /* Arrange to process next channel up for a status change. */ + qdf_timer_mod(&dfs->dfs_nol_timer, + dfs_get_nol_timeout(dfs) - + qdf_system_ticks_to_msecs(qdf_system_ticks())); + } +} + +void dfs_nol_timer_init(struct wlan_dfs *dfs) +{ + qdf_timer_init(NULL, + &(dfs->dfs_nol_timer), + dfs_nol_timeout, + (void *)(dfs), + QDF_TIMER_TYPE_WAKE_APPS); +} + +void dfs_nol_attach(struct wlan_dfs *dfs) +{ + dfs_nol_timer_init(dfs); +} /** * dfs_nol_delete() - Delete the given frequency/chwidth from the NOL. @@ -277,7 +348,7 @@ void dfs_nol_addchan(struct wlan_dfs *dfs, __func__, nol->nol_freq, nol->nol_chwidth); qdf_timer_stop(&nol->nol_timer); - OS_SET_TIMER(&nol->nol_timer, + qdf_timer_mod(&nol->nol_timer, dfs_nol_timeout * TIME_IN_MS); return; } @@ -306,7 +377,7 @@ void dfs_nol_addchan(struct wlan_dfs *dfs, qdf_timer_init(NULL, &elem->nol_timer, dfs_remove_from_nol, elem, QDF_TIMER_TYPE_WAKE_APPS); - OS_SET_TIMER(&elem->nol_timer, dfs_nol_timeout * TIME_IN_MS); + qdf_timer_mod(&elem->nol_timer, dfs_nol_timeout * TIME_IN_MS); /* Update the NOL counter. */ dfs->dfs_nol_count++; @@ -426,6 +497,11 @@ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs) dfs_nol_update(dfs); } +void dfs_nol_detach(struct wlan_dfs *dfs) +{ + dfs_nol_timer_cleanup(dfs); +} + int dfs_get_rn_use_nol(struct wlan_dfs *dfs) { return dfs->dfs_rinfo.rn_use_nol; @@ -435,3 +511,32 @@ int dfs_get_nol_timeout(struct wlan_dfs *dfs) { return dfs->wlan_dfs_nol_timeout; } + +void dfs_getnol(struct wlan_dfs *dfs, void *dfs_nolinfo) +{ + struct dfsreq_nolinfo *nolinfo = (struct dfsreq_nolinfo *)dfs_nolinfo; + + dfs_get_nol(dfs, nolinfo->dfs_nol, &(nolinfo->dfs_ch_nchans)); +} + +void dfs_clear_nolhistory(struct wlan_dfs *dfs) +{ + /* We should have a dfs_clear_nolhistory API from Regdomain. */ + struct dfs_ieee80211_channel *c, lc; + int i; + int nchans = 0; + + c = &lc; + dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans); + for (i = 0; i < nchans; i++) { + dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj, + &(c->dfs_ch_freq), + &(c->dfs_ch_flags), + &(c->dfs_ch_flagext), + &(c->dfs_ch_ieee), + &(c->dfs_ch_vhtop_ch_freq_seg1), + &(c->dfs_ch_vhtop_ch_freq_seg2), + i); + IEEE80211_CHAN_CLR_HISTORY_RADAR(c); + } +} diff --git a/umac/dfs/core/src/misc/dfs_zero_cac.c b/umac/dfs/core/src/misc/dfs_zero_cac.c index cd7903af45a5..f28ac88dbf60 100644 --- a/umac/dfs/core/src/misc/dfs_zero_cac.c +++ b/umac/dfs/core/src/misc/dfs_zero_cac.c @@ -94,25 +94,14 @@ #include "wlan_dfs_mlme_api.h" #include "../dfs_internal.h" -static os_timer_func(dfs_precac_timeout); - -void dfs_zero_cac_attach(struct wlan_dfs *dfs) -{ - dfs->dfs_precac_timeout_override = -1; - dfs_init_precac_list(dfs); - qdf_timer_init(NULL, - &(dfs->dfs_precac_timer), - dfs_precac_timeout, - (void *) dfs, - QDF_TIMER_TYPE_WAKE_APPS); -} - void dfs_zero_cac_reset(struct wlan_dfs *dfs) { - dfs->dfs_precac_timeout_override = -1; + dfs_get_override_precac_timeout(dfs, + &(dfs->dfs_precac_timeout_override)); qdf_timer_stop(&dfs->dfs_precac_timer); dfs->dfs_precac_primary_freq = 0; dfs->dfs_precac_secondary_freq = 0; + dfs_init_precac_list(dfs); } int dfs_override_precac_timeout(struct wlan_dfs *dfs, int precac_timeout) @@ -289,7 +278,7 @@ void dfs_mark_precac_dfs(struct wlan_dfs *dfs, precac_entry->vht80_freq); TAILQ_INSERT_TAIL(&dfs->dfs_precac_nol_list, precac_entry, pe_list); - OS_SET_TIMER(&precac_entry->precac_nol_timer, + qdf_timer_mod(&precac_entry->precac_nol_timer, dfs_get_nol_timeout(dfs)*1000); found = 1; break; @@ -322,7 +311,7 @@ void dfs_mark_precac_dfs(struct wlan_dfs *dfs, precac_entry->vht80_freq); TAILQ_INSERT_TAIL(&dfs->dfs_precac_nol_list, precac_entry, pe_list); - OS_SET_TIMER(&precac_entry->precac_nol_timer, + qdf_timer_mod(&precac_entry->precac_nol_timer, dfs_get_nol_timeout(dfs)*1000); break; } @@ -438,6 +427,21 @@ static os_timer_func(dfs_precac_timeout) dfs_mlme_channel_change_by_precac(dfs->dfs_pdev_obj); } +void dfs_zero_cac_timer_init(struct wlan_dfs *dfs) +{ + qdf_timer_init(NULL, + &(dfs->dfs_precac_timer), + dfs_precac_timeout, + (void *) dfs, + QDF_TIMER_TYPE_WAKE_APPS); +} + +void dfs_zero_cac_attach(struct wlan_dfs *dfs) +{ + dfs->dfs_precac_timeout_override = -1; + dfs_zero_cac_timer_init(dfs); +} + /** * dfs_precac_nol_timeout() - NOL timeout for precac channel. * @@ -481,7 +485,7 @@ void dfs_init_precac_list(struct wlan_dfs *dfs) * 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 + * and copy the uniq list of frequencies to the final list with exact * size. */ TAILQ_INIT(&dfs->dfs_precac_required_list); @@ -598,6 +602,11 @@ void dfs_deinit_precac_list(struct wlan_dfs *dfs) } +void dfs_zero_cac_detach(struct wlan_dfs *dfs) +{ + dfs_deinit_precac_list(dfs); +} + uint8_t dfs_get_freq_from_precac_required_list(struct wlan_dfs *dfs, uint8_t exclude_ieee_freq) { @@ -684,7 +693,7 @@ void dfs_start_precac_timer(struct wlan_dfs *dfs, uint8_t precac_chan) DFS_DPRINTK(dfs, WLAN_DEBUG_DFS, "%s : precactimeout = %d\n", __func__, (precac_timeout)*1000); - OS_SET_TIMER(&dfs->dfs_precac_timer, (precac_timeout) * 1000); + qdf_timer_mod(&dfs->dfs_precac_timer, (precac_timeout) * 1000); } void dfs_print_precaclists(struct wlan_dfs *dfs) diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h index 21f2a120c97a..ad60efe97b74 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h @@ -49,15 +49,6 @@ QDF_STATUS tgt_dfs_set_current_channel(struct wlan_objmgr_pdev *pdev, uint8_t dfs_ch_vhtop_ch_freq_seg1, uint8_t dfs_ch_vhtop_ch_freq_seg2); -/** - * tgt_dfs_reset() - DFS reset - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for dfs_reset(). This function called from outside of DFS - * component. - */ -QDF_STATUS tgt_dfs_reset(struct wlan_objmgr_pdev *pdev); - /** * tgt_dfs_get_radars() - Based on the chipset, calls init radar table functions * @pdev: Pointer to DFS pdev object. @@ -108,24 +99,6 @@ QDF_STATUS tgt_dfs_destroy_object(struct wlan_objmgr_pdev *pdev); QDF_STATUS tgt_dfs_radar_enable(struct wlan_objmgr_pdev *pdev, int no_cac, uint32_t opmode); -/** - * tgt_dfs_attach() - Allocates memory for wlan_dfs members. - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for dfs_attach(). This function called from - * outside of DFS component. - */ -QDF_STATUS tgt_dfs_attach(struct wlan_objmgr_pdev *pdev); - -/** - * tgt_sif_dfs_detach() - DFS detach. - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for sif_dfs_attach(). This function called from - * outside of DFS component. - */ -QDF_STATUS tgt_sif_dfs_detach(struct wlan_objmgr_pdev *pdev); - /** * tgt_dfs_control()- Used to process ioctls related to DFS. * @pdev: Pointer to DFS pdev object. @@ -143,15 +116,6 @@ QDF_STATUS tgt_dfs_control(struct wlan_objmgr_pdev *pdev, uint32_t *outsize, int *error); -/** - * tgt_nif_dfs_reset() - DFS reset. - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for nif_dfs_reset(). This function called from - * outside of DFS component. - */ -QDF_STATUS tgt_nif_dfs_reset(struct wlan_objmgr_pdev *pdev); - /** * tgt_dfs_is_precac_timer_running() - Check whether precac timer is running. * @pdev: Pointer to DFS pdev object. diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h index 9e8965250fb8..4ee88c0c9bc0 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h @@ -83,24 +83,6 @@ extern struct dfs_to_mlme global_dfs_to_mlme; -/** - * utils_nif_dfs_attach() - DFS attach function. - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for nif_dfs_attach(). This function called from outside of - * DFS component. - */ -QDF_STATUS utils_nif_dfs_attach(struct wlan_objmgr_pdev *pdev); - -/** - * utils_nif_dfs_detach() - DFS detach - * @pdev: Pointer to DFS pdev object. - * - * Wrapper function for nif_dfs_detach(). This function called from outside of - * DFS component. - */ -QDF_STATUS utils_nif_dfs_detach(struct wlan_objmgr_pdev *pdev); - /** * utils_dfs_cac_valid_reset() - Cancels the dfs_cac_valid_timer timer. * @pdev: Pointer to DFS pdev object. @@ -115,6 +97,12 @@ QDF_STATUS utils_dfs_cac_valid_reset(struct wlan_objmgr_pdev *pdev, uint8_t prevchan_ieee, uint32_t prevchan_flags); +/** + * utils_dfs_reset() - Reset DFS members. + * @pdev: Pointer to DFS pdev object. + */ +QDF_STATUS utils_dfs_reset(struct wlan_objmgr_pdev *pdev); + /** * utils_dfs_reset_precaclists() - Clears and initiakizes precac_required_list, * precac_done_list and precac_nol_list. @@ -432,7 +420,7 @@ void utils_dfs_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t utils_dfs_freq_to_chan(uint32_t freq); /** - * utils_dfs__chan_to_freq () - convert channel number to frequency + * utils_dfs_chan_to_freq () - convert channel number to frequency * @chan: channel number * * Return: frequency diff --git a/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c b/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c index 710e9e3e3f2f..1f0a69b30df3 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c @@ -197,8 +197,8 @@ QDF_STATUS wlan_dfs_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev, WLAN_UMAC_COMP_DFS, (void *)dfs); - nif_dfs_detach(dfs); - sif_dfs_detach(dfs); + dfs_reset(dfs); + dfs_detach(dfs); dfs->dfs_pdev_obj = NULL; dfs_destroy_object(dfs); } diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index d98bcd9305bd..6e46cc7f3530 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -61,20 +61,6 @@ QDF_STATUS tgt_dfs_set_current_channel(struct wlan_objmgr_pdev *pdev, } EXPORT_SYMBOL(tgt_dfs_set_current_channel); -QDF_STATUS tgt_dfs_reset(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_dfs *dfs; - - dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (dfs == NULL) - return QDF_STATUS_E_FAILURE; - - dfs_reset(dfs); - - return QDF_STATUS_SUCCESS; -} -EXPORT_SYMBOL(tgt_dfs_reset); - QDF_STATUS tgt_dfs_radar_enable(struct wlan_objmgr_pdev *pdev, int no_cac, uint32_t opmode) { @@ -140,18 +126,6 @@ QDF_STATUS tgt_dfs_get_radars(struct wlan_objmgr_pdev *pdev) } EXPORT_SYMBOL(tgt_dfs_get_radars); -QDF_STATUS tgt_dfs_attach(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_dfs *dfs; - - dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (dfs == NULL) - return QDF_STATUS_E_FAILURE; - - return dfs_attach(dfs); -} -EXPORT_SYMBOL(tgt_dfs_attach); - QDF_STATUS tgt_dfs_destroy_object(struct wlan_objmgr_pdev *pdev) { struct wlan_dfs *dfs; @@ -167,31 +141,6 @@ QDF_STATUS tgt_dfs_destroy_object(struct wlan_objmgr_pdev *pdev) } EXPORT_SYMBOL(tgt_dfs_destroy_object); -QDF_STATUS tgt_nif_dfs_reset(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_dfs *dfs; - - dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (dfs == NULL) - return QDF_STATUS_E_FAILURE; - - nif_dfs_reset(dfs); - return QDF_STATUS_SUCCESS; -} -EXPORT_SYMBOL(tgt_nif_dfs_reset); - -QDF_STATUS tgt_sif_dfs_detach(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_dfs *dfs; - - dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (dfs == NULL) - return QDF_STATUS_E_FAILURE; - - sif_dfs_detach(dfs); - return QDF_STATUS_SUCCESS; -} - QDF_STATUS tgt_dfs_control(struct wlan_objmgr_pdev *pdev, u_int id, void *indata, diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index b11758d81f73..fe2424460d70 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -37,7 +37,7 @@ struct dfs_nol_info { struct dfsreq_nolelem dfs_nol[DFS_MAX_NOL_CHANNEL]; }; -QDF_STATUS utils_nif_dfs_attach(struct wlan_objmgr_pdev *pdev) +QDF_STATUS utils_dfs_reset(struct wlan_objmgr_pdev *pdev) { struct wlan_dfs *dfs; @@ -45,25 +45,10 @@ QDF_STATUS utils_nif_dfs_attach(struct wlan_objmgr_pdev *pdev) if (dfs == NULL) return QDF_STATUS_E_FAILURE; - nif_dfs_attach(dfs); + dfs_reset(dfs); return QDF_STATUS_SUCCESS; } -EXPORT_SYMBOL(utils_nif_dfs_attach); - -QDF_STATUS utils_nif_dfs_detach(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_dfs *dfs; - - dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (dfs == NULL) - return QDF_STATUS_E_FAILURE; - - nif_dfs_detach(dfs); - - return QDF_STATUS_SUCCESS; -} -EXPORT_SYMBOL(utils_nif_dfs_detach); QDF_STATUS utils_dfs_cac_valid_reset(struct wlan_objmgr_pdev *pdev, uint8_t prevchan_ieee, diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index e6b713defe4f..b7aa04440d16 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -786,15 +786,11 @@ struct wlan_lmac_if_nan_rx_ops { /** * struct wlan_lmac_if_dfs_rx_ops - Function pointers to call dfs functions * from lmac/offload. - * @dfs_reset: Reset dfs. * @dfs_get_radars: Calls init radar table functions. * @dfs_process_phyerr: Process phyerr. * @dfs_destroy_object: Destroys the DFS object. * @dfs_radar_enable: Enables the radar. - * @dfs_attach: Allocates memory for wlan_dfs members. - * @dfs_sif_dfs_detach: DFS detach. * @dfs_control: Used to process ioctls related to DFS. - * @dfs_nif_dfs_reset: DFS reset. * @dfs_is_precac_timer_running: Check whether precac timer is running. * @dfs_find_vht80_chan_for_precac: Find VHT80 channel for precac. * @dfs_cancel_precac_timer: Cancel the precac timer. @@ -807,7 +803,6 @@ struct wlan_lmac_if_nan_rx_ops { * @dfs_dfs_cac_complete_ind: Process cac complete indication. */ struct wlan_lmac_if_dfs_rx_ops { - QDF_STATUS (*dfs_reset)(struct wlan_objmgr_pdev *pdev); QDF_STATUS (*dfs_get_radars)(struct wlan_objmgr_pdev *pdev); QDF_STATUS (*dfs_process_phyerr)(struct wlan_objmgr_pdev *pdev, void *buf, @@ -820,8 +815,6 @@ struct wlan_lmac_if_dfs_rx_ops { QDF_STATUS (*dfs_radar_enable)(struct wlan_objmgr_pdev *pdev, int no_cac, uint32_t opmode); - QDF_STATUS (*dfs_attach)(struct wlan_objmgr_pdev *pdev); - QDF_STATUS (*dfs_sif_dfs_detach)(struct wlan_objmgr_pdev *pdev); QDF_STATUS (*dfs_control)(struct wlan_objmgr_pdev *pdev, u_int id, void *indata, @@ -829,7 +822,6 @@ struct wlan_lmac_if_dfs_rx_ops { void *outdata, uint32_t *outsize, int *error); - QDF_STATUS (*dfs_nif_dfs_reset)(struct wlan_objmgr_pdev *pdev); QDF_STATUS (*dfs_is_precac_timer_running)(struct wlan_objmgr_pdev *pdev, bool *is_precac_timer_running); QDF_STATUS (*dfs_find_vht80_chan_for_precac)(struct wlan_objmgr_pdev *pdev, diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index 2e07c96b8991..cf030a9d0185 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -229,15 +229,11 @@ wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) dfs_rx_ops = &rx_ops->dfs_rx_ops; - dfs_rx_ops->dfs_reset = tgt_dfs_reset; dfs_rx_ops->dfs_get_radars = tgt_dfs_get_radars; dfs_rx_ops->dfs_process_phyerr = tgt_dfs_process_phyerr; dfs_rx_ops->dfs_destroy_object = tgt_dfs_destroy_object; dfs_rx_ops->dfs_radar_enable = tgt_dfs_radar_enable; - dfs_rx_ops->dfs_attach = tgt_dfs_attach; - dfs_rx_ops->dfs_sif_dfs_detach = tgt_sif_dfs_detach; dfs_rx_ops->dfs_control = tgt_dfs_control; - dfs_rx_ops->dfs_nif_dfs_reset = tgt_nif_dfs_reset; dfs_rx_ops->dfs_is_precac_timer_running = tgt_dfs_is_precac_timer_running; dfs_rx_ops->dfs_find_vht80_chan_for_precac = From fe7233a7954d44e7646ac598c04db7d4627a02e5 Mon Sep 17 00:00:00 2001 From: Abhijit Pradhan Date: Wed, 12 Jul 2017 18:48:14 +0530 Subject: [PATCH 2/4] qcacmn: Fix DFS kernel panic As part of DFS component destroy, "ic" is accessed to reset NOL list and PRECAC channel list, but "ic" is already deleted as part of MLME component destroy. And therefore invalid memory access happens. Reset NOL list and PRECAC channel list before "ic" deletion. Change-Id: I1dbf273f1ea51945493140bfce9bfa116ad0c488 CRs-Fixed: 2071164 --- umac/dfs/core/src/dfs.h | 14 ++++++-------- umac/dfs/core/src/misc/dfs.c | 11 +++++++---- umac/dfs/core/src/misc/dfs_nol.c | 5 ----- umac/dfs/core/src/misc/dfs_zero_cac.c | 1 - umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h | 6 ++++++ umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c | 14 ++++++++++++++ .../lmac_if/inc/wlan_lmac_if_def.h | 2 ++ .../lmac_if/src/wlan_lmac_if.c | 1 + 8 files changed, 36 insertions(+), 18 deletions(-) diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index d5039719826e..c656e4b9773d 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -1061,14 +1061,6 @@ void dfs_nol_update(struct wlan_dfs *dfs); */ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs); -/** - * dfs_nol_detach() - Free NOL variables. - * @dfs: Pointer to wlan_dfs structure. - * - * Cancels the NOL timer and frees the NOL elements. - */ -void dfs_nol_detach(struct wlan_dfs *dfs); - /** * dfs_retain_bin5_burst_pattern() - Retain the BIN5 burst pattern. * @dfs: Pointer to wlan_dfs structure. @@ -1924,4 +1916,10 @@ void dfs_main_timer_init(struct wlan_dfs *dfs); * @dfs: Pointer to wlan_dfs structure. */ void dfs_main_timer_reset(struct wlan_dfs *dfs); + +/** + * dfs_stop() - Clear dfs timers. + * @dfs: Pointer to wlan_dfs structure. + */ +void dfs_stop(struct wlan_dfs *dfs); #endif /* _DFS_H_ */ diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index 683f79012924..f44ab4470847 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -326,6 +326,13 @@ int dfs_attach(struct wlan_dfs *dfs) return 0; } +void dfs_stop(struct wlan_dfs *dfs) +{ + dfs_init_precac_list(dfs); + dfs_nol_timer_cleanup(dfs); + dfs_clear_nolhistory(dfs); +} + void dfs_main_timer_reset(struct wlan_dfs *dfs) { if (dfs->wlan_radar_tasksched) { @@ -350,9 +357,6 @@ void dfs_reset(struct wlan_dfs *dfs) dfs_cac_timer_reset(dfs); dfs_zero_cac_reset(dfs); dfs_main_timer_reset(dfs); - - dfs_nol_timer_cleanup(dfs); - dfs_clear_nolhistory(dfs); } void dfs_main_detach(struct wlan_dfs *dfs) @@ -419,7 +423,6 @@ void dfs_detach(struct wlan_dfs *dfs) { dfs_main_detach(dfs); dfs_zero_cac_detach(dfs); - dfs_nol_detach(dfs); } void dfs_destroy_object(struct wlan_dfs *dfs) diff --git a/umac/dfs/core/src/misc/dfs_nol.c b/umac/dfs/core/src/misc/dfs_nol.c index 870fb05e4f85..388babdf4ff8 100644 --- a/umac/dfs/core/src/misc/dfs_nol.c +++ b/umac/dfs/core/src/misc/dfs_nol.c @@ -497,11 +497,6 @@ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs) dfs_nol_update(dfs); } -void dfs_nol_detach(struct wlan_dfs *dfs) -{ - dfs_nol_timer_cleanup(dfs); -} - int dfs_get_rn_use_nol(struct wlan_dfs *dfs) { return dfs->dfs_rinfo.rn_use_nol; diff --git a/umac/dfs/core/src/misc/dfs_zero_cac.c b/umac/dfs/core/src/misc/dfs_zero_cac.c index f28ac88dbf60..4e405a260e1e 100644 --- a/umac/dfs/core/src/misc/dfs_zero_cac.c +++ b/umac/dfs/core/src/misc/dfs_zero_cac.c @@ -101,7 +101,6 @@ void dfs_zero_cac_reset(struct wlan_dfs *dfs) qdf_timer_stop(&dfs->dfs_precac_timer); dfs->dfs_precac_primary_freq = 0; dfs->dfs_precac_secondary_freq = 0; - dfs_init_precac_list(dfs); } int dfs_override_precac_timeout(struct wlan_dfs *dfs, int precac_timeout) diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h index ad60efe97b74..f2fddc4163d2 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h @@ -185,4 +185,10 @@ QDF_STATUS tgt_dfs_cac_complete(struct wlan_objmgr_pdev *pdev, */ QDF_STATUS tgt_dfs_reg_ev_handler(struct wlan_objmgr_psoc *psoc, bool dfs_offload); + +/** + * tgt_dfs_stop() - Clear dfs timers. + * @dfs: Pointer to wlan_dfs structure. + */ +QDF_STATUS tgt_dfs_stop(struct wlan_objmgr_pdev *pdev); #endif /* _WLAN_DFS_TGT_API_H_ */ diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index 6e46cc7f3530..8bd536778fac 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -248,3 +248,17 @@ QDF_STATUS tgt_dfs_reg_ev_handler(struct wlan_objmgr_psoc *psoc, return status; } EXPORT_SYMBOL(tgt_dfs_reg_ev_handler); + +QDF_STATUS tgt_dfs_stop(struct wlan_objmgr_pdev *pdev) +{ + struct wlan_dfs *dfs; + + dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); + if (dfs == NULL) + return QDF_STATUS_E_FAILURE; + + dfs_stop(dfs); + + return QDF_STATUS_SUCCESS; +} +EXPORT_SYMBOL(tgt_dfs_stop); diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index b7aa04440d16..cd5b3e2baa54 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -801,6 +801,7 @@ struct wlan_lmac_if_nan_rx_ops { * @dfs_set_current_channel: Set DFS current channel. * @dfs_process_radar_ind: Process radar found indication. * @dfs_dfs_cac_complete_ind: Process cac complete indication. + * @dfs_stop: Clear dfs timers. */ struct wlan_lmac_if_dfs_rx_ops { QDF_STATUS (*dfs_get_radars)(struct wlan_objmgr_pdev *pdev); @@ -856,6 +857,7 @@ struct wlan_lmac_if_dfs_rx_ops { QDF_STATUS (*dfs_dfs_cac_complete_ind)(struct wlan_objmgr_pdev *pdev, uint32_t vdev_id); #endif + QDF_STATUS (*dfs_stop)(struct wlan_objmgr_pdev *pdev); }; struct wlan_lmac_if_mlme_rx_ops { diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index cf030a9d0185..554743b6a06a 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -248,6 +248,7 @@ wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) dfs_rx_ops->dfs_set_current_channel = tgt_dfs_set_current_channel; dfs_rx_ops->dfs_process_radar_ind = tgt_dfs_process_radar_ind; dfs_rx_ops->dfs_dfs_cac_complete_ind = tgt_dfs_cac_complete; + dfs_rx_ops->dfs_stop = tgt_dfs_stop; return QDF_STATUS_SUCCESS; } From 6560d45bd2e8f308e08e0478f7b24b5ccbd7bcf0 Mon Sep 17 00:00:00 2001 From: Venkata Sharath Chandra Manchala Date: Thu, 13 Jul 2017 16:42:18 -0700 Subject: [PATCH 3/4] qcacmn: Remove duplicate prints in tx path Avoid printing skb info twice upon entering the dp_tx_send API. Change-Id: Ia719025f034f45fea5a947b3e40fbeb693dfceca CRs-Fixed: 2076271 --- dp/wifi3.0/dp_tx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 2eac27df195d..2d9efb731f6e 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -1439,10 +1439,6 @@ out: if (qdf_unlikely(vdev->mesh_vdev)) dp_tx_extract_mesh_meta_data(vdev, nbuf, &msdu_info); - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, - "%s , skb %0x:%0x:%0x:%0x:%0x:%0x\n", - __func__, nbuf->data[0], nbuf->data[1], nbuf->data[2], - nbuf->data[3], nbuf->data[4], nbuf->data[5]); /* * Get HW Queue to use for this frame. * TCL supports upto 4 DMA rings, out of which 3 rings are From a5e5c6410a276c2251d76b155203273aa6341566 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Fri, 23 Jun 2017 16:39:17 +0800 Subject: [PATCH 4/4] qcacmn: Free events logs list of wmi handle Free events logs list of wmi handle, avoid memory leak. Change-Id: I7660239f3808ebf0f56baf5900c1290218507406 CRs-Fixed: 2062407 --- wmi/src/wmi_unified.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c index b3069b1e827f..910a3aae71f9 100644 --- a/wmi/src/wmi_unified.c +++ b/wmi/src/wmi_unified.c @@ -2777,6 +2777,12 @@ void wmi_unified_detach(struct wmi_unified *wmi_handle) } wmi_log_buffer_free(soc->wmi_pdev[i]); + + /* Free events logs list */ + if (soc->wmi_pdev[i]->events_logs_list) + qdf_mem_free( + soc->wmi_pdev[i]->events_logs_list); + qdf_spinlock_destroy(&soc->wmi_pdev[i]->eventq_lock); qdf_mem_free(soc->wmi_pdev[i]); }