From bad46ee2dae74d6346e32d543ccb494a0ed8b71c Mon Sep 17 00:00:00 2001 From: Shreedhar Parande Date: Fri, 8 Feb 2019 12:15:11 +0530 Subject: [PATCH] qcacmn: Enhancement of auto channel switch zerowait PreCAC for 160MHz mode If user configures DFS channel in 160MHz mode, 1. change mode to 80MHz and do PreCAC on primary and secondary channels of 160MHz. 2. Use intermediate channel to operate. 3. Once PreCAC done on the both primary and secondary channels and is clear then change mode back to 160MHz. 4. Change the channel from intermediate to configured DFS channel. Use Broadcast and Unicast OMN frame to notify mode change. Change-Id: I1f2db0f38b42fce2f407988041edfea9c49c58e1 CRs-fixed: 2395431 --- umac/dfs/core/src/dfs.h | 8 ++++-- umac/dfs/core/src/dfs_zero_cac.h | 26 ++++++++++++------- umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h | 2 +- umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h | 5 ++-- umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h | 15 ++++++----- umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c | 2 +- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 14 +++++----- .../lmac_if/inc/wlan_lmac_if_def.h | 5 ++-- 8 files changed, 46 insertions(+), 31 deletions(-) diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index 14daba3059d6..e12ab552209b 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -929,9 +929,12 @@ struct dfs_event_log { * @dfs_precac_primary_freq: Primary freq. * @dfs_precac_timer_running: Precac timer running. * @dfs_defer_precac_channel_change: Defer precac channel change. - * @dfs_precac_preferred_chan: Channel to change after precac. * @dfs_precac_inter_chan: Intermediate non-DFS channel used while * doing precac. + * @dfs_autoswitch_des_chan: Desired channel which has to be used + * after precac. + * @dfs_autoswitch_des_mode: Desired PHY mode which has to be used + * after precac. * @dfs_pre_cac_timeout_channel_change: Channel change due to precac timeout. * @wlan_dfs_task_timer: Dfs wait timer. * @dur_multiplier: Duration multiplier. @@ -1076,8 +1079,9 @@ struct wlan_dfs { uint8_t dfs_precac_timer_running; uint8_t dfs_defer_precac_channel_change; #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT - uint8_t dfs_precac_preferred_chan; uint8_t dfs_precac_inter_chan; + uint8_t dfs_autoswitch_des_chan; + enum wlan_phymode dfs_autoswitch_des_mode; #endif uint8_t dfs_pre_cac_timeout_channel_change:1; qdf_timer_t wlan_dfs_task_timer; diff --git a/umac/dfs/core/src/dfs_zero_cac.h b/umac/dfs/core/src/dfs_zero_cac.h index 9f70819c418e..70d98482937d 100644 --- a/umac/dfs/core/src/dfs_zero_cac.h +++ b/umac/dfs/core/src/dfs_zero_cac.h @@ -223,14 +223,19 @@ static inline bool dfs_is_precac_done(struct wlan_dfs *dfs, * precac status of configured * DFS channel. * @dfs: Pointer to wlan_dfs structure. - * @pref_chan: Congigired DFS channel. + * @pref_chan: Configured DFS channel. + * @mode: Configured PHY mode. * - * Return: void. + * Return: True if intermediate channel needs to configure. False otherwise. */ -void dfs_decide_precac_preferred_chan(struct wlan_dfs *dfs, uint8_t *pref_chan); +bool +dfs_decide_precac_preferred_chan(struct wlan_dfs *dfs, + uint8_t *pref_chan, + enum wlan_phymode mode); #else static inline void dfs_decide_precac_preferred_chan(struct wlan_dfs *dfs, - uint8_t *pref_chan) + uint8_t *pref_chan, + enum wlan_phymode mode) { } #endif @@ -443,17 +448,18 @@ bool dfs_is_ht20_40_80_chan_in_precac_done_list(struct wlan_dfs *dfs, struct dfs_channel *chan); /** - * dfs_is_ht80_80_chan_in_precac_done_list() - Is precac done on a VHT80+80 - * channel. - *@dfs: Pointer to wlan_dfs structure. - *@chan: Pointer to dfs_channel for which preCAC done is checked. + * dfs_is_ht8080_ht160_chan_in_precac_done_list() - Is precac done on + * VHT80+80 or VHT160 + * channel. + * @dfs: Pointer to wlan_dfs structure. + * @chan: Pointer to dfs_channel for which preCAC done is checked. * * Return: * * True: If channel is present in precac-done list. * * False: If channel is not present in precac-done list. */ -bool dfs_is_ht80_80_chan_in_precac_done_list(struct wlan_dfs *dfs, - struct dfs_channel *chan); +bool dfs_is_ht8080_ht160_chan_in_precac_done_list(struct wlan_dfs *dfs, + struct dfs_channel *chan); /** * dfs_mark_precac_dfs() - Mark the precac channel as radar. diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h index dab1edda5d17..3719595f8586 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h index 7828f7677a17..74e436921b35 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -124,7 +124,8 @@ struct dfs_to_mlme { struct wlan_objmgr_pdev *pdev); #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT QDF_STATUS (*mlme_precac_chan_change_csa)(struct wlan_objmgr_pdev *pdev, - uint8_t ch_ieee); + uint8_t des_chan, + enum wlan_phymode des_mode); #endif QDF_STATUS (*mlme_nol_timeout_notification)( struct wlan_objmgr_pdev *pdev); diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h index ab52ddc0be9e..e5301d35ddef 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h @@ -171,17 +171,18 @@ QDF_STATUS utils_dfs_start_precac_timer(struct wlan_objmgr_pdev *pdev); /** * utils_dfs_precac_decide_pref_chan() - Choose preferred channel * @pdev: Pointer to DFS pdev object. - * @ch_ieee: Pointer to channel number - + * @ch_ieee: Pointer to channel number. + * @mode: Configured PHY mode. + * * Wrapper function for dfs_decide_precac_preferred_chan(). This * function called from outside of dfs component. * - * Return: - * * QDF_STATUS_E_FAILURE: Failed to decide preferred channel. - * * QDF_STATUS_SUCCESS: Set preferred channel successfully. + * Return: True if intermediate channel needs to configure. False otherwise. */ -QDF_STATUS utils_dfs_precac_decide_pref_chan(struct wlan_objmgr_pdev *pdev, - uint8_t *ch_ieee); +bool +utils_dfs_precac_decide_pref_chan(struct wlan_objmgr_pdev *pdev, + uint8_t *ch_ieee, + enum wlan_phymode mode); #endif /** diff --git a/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c b/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c index 94b5b96d073c..f2be70a89ff8 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index e089c5b91914..023dae89eafd 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -140,24 +140,26 @@ QDF_STATUS utils_dfs_start_precac_timer(struct wlan_objmgr_pdev *pdev) dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "NULL dfs"); return QDF_STATUS_E_FAILURE; } + if (!dfs->dfs_precac_secondary_freq) + return QDF_STATUS_E_FAILURE; dfs_start_precac_timer(dfs, dfs->dfs_precac_secondary_freq); return QDF_STATUS_SUCCESS; } #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT -QDF_STATUS utils_dfs_precac_decide_pref_chan(struct wlan_objmgr_pdev *pdev, - uint8_t *ch_ieee) +bool +utils_dfs_precac_decide_pref_chan(struct wlan_objmgr_pdev *pdev, + uint8_t *ch_ieee, + enum wlan_phymode mode) { struct wlan_dfs *dfs; dfs = wlan_pdev_get_dfs_obj(pdev); if (!dfs) { dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "NULL dfs"); - return QDF_STATUS_E_FAILURE; + return false; } - dfs_decide_precac_preferred_chan(dfs, ch_ieee); - - return QDF_STATUS_SUCCESS; + return dfs_decide_precac_preferred_chan(dfs, ch_ieee, mode); } #endif 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 85561b965250..a23d4c052e7d 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 @@ -1291,8 +1291,9 @@ struct wlan_lmac_if_dfs_rx_ops { uint32_t value); QDF_STATUS (*dfs_get_precac_intermediate_chan)(struct wlan_objmgr_pdev *pdev, int *buff); - QDF_STATUS (*dfs_decide_precac_preferred_chan)(struct wlan_objmgr_pdev *pdev, - uint8_t *pref_chan); + bool (*dfs_decide_precac_preferred_chan)(struct wlan_objmgr_pdev *pdev, + uint8_t *pref_chan, + enum wlan_phymode mode); enum precac_chan_state (*dfs_get_precac_chan_state)(struct wlan_objmgr_pdev *pdev, uint8_t precac_chan); #endif