From 48c594436d3e28ef43f5f353ff77621b81ebddef Mon Sep 17 00:00:00 2001 From: Vignesh Mohan Date: Wed, 12 Feb 2020 14:38:43 +0530 Subject: [PATCH] qcacmn: Add API to identify true 160 and restricted 80p80 support In a future product, 160MHz mode of operation is acheived through a single detector, unlike Hawkeye and its variants where 160MHz mode is acheived using two 80MHz detectors. Because of this change, the maximum segment ID is 0 in the new chipset, whereas 1 in Hawkeye and its variants. Also the Agile detector ID is 1 in the new chipset, 2 in Hawkeye and its variants. In light of these changes, to identify the true 160MHz capability, add a new API that checks the target type and returns true 160MHz capability based on the target type. Also introduce a new dfs variable that maintains the agile detector ID (based on the true 160MHz capability). In the future product, there is a support of restricted-80p80MHz (a.k.a 165Mhz) where channels 132,136,140,144,149,153,157,161 are available for operation as an 80p80Mhz channel. Add a DFS API to check if this support is enabled. CRs-Fixed: 2623964 Change-Id: If813e9d6fc649ce99c7780c04fbcb61acbd1af86 --- target_if/core/inc/target_if.h | 9 ++- target_if/core/src/target_if_main.c | 8 +++ umac/dfs/core/src/dfs.h | 63 +++++++++++++++++-- umac/dfs/core/src/dfs_channel.h | 6 +- umac/dfs/core/src/misc/dfs.c | 26 ++++++++ .../src/misc/dfs_process_radar_found_ind.c | 22 +++---- .../lmac_if/inc/wlan_lmac_if_def.h | 2 + 7 files changed, 118 insertions(+), 18 deletions(-) diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index 3f229597393c..c6a215ebe8ac 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -502,6 +502,13 @@ bool target_is_tgt_type_qca9888(uint32_t target_type); */ bool target_is_tgt_type_adrastea(uint32_t target_type); +/** + * target_is_tgt_type_qcn9000() - Check if the target type is QCN9000 (pine) + * @target_type: target type to be checked. + * + * Return: true if the target_type is QCN9000, else false. + */ +bool target_is_tgt_type_qcn9000(uint32_t target_type); /** * target_psoc_set_wlan_init_status() - set info wlan_init_status diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 55ca584a5341..7dbd25c7d66f 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -388,6 +388,9 @@ static void target_if_target_tx_ops_register( target_tx_ops->tgt_is_tgt_type_adrastea = target_is_tgt_type_adrastea; + target_tx_ops->tgt_is_tgt_type_qcn9000 = + target_is_tgt_type_qcn9000; + target_tx_ops->tgt_get_tgt_type = lmac_get_tgt_type; @@ -650,3 +653,8 @@ bool target_is_tgt_type_adrastea(uint32_t target_type) { return target_type == TARGET_TYPE_ADRASTEA; } + +bool target_is_tgt_type_qcn9000(uint32_t target_type) +{ + return target_type == TARGET_TYPE_QCN9000; +} diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index ee89cd2b1e20..e634153414e1 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -41,6 +41,7 @@ #include #include #include +#include "target_type.h" /* File Line and Submodule String */ #define FLSM(x, str) #str " : " FL(x) @@ -403,11 +404,24 @@ */ #define USENOL_ENABLE_NOL_HOST_DISABLE_NOL_FW 2 -/* Non Agile detector IDs */ -#define DETECTOR_ID_0 0 -#define DETECTOR_ID_1 1 -/* Agile detector ID */ -#define AGILE_DETECTOR_ID 2 +/** + * enum detector_id - Detector ID values. + * @DETECTOR_ID_0: Detector ID 0 (Non Agile). + * @DETECTOR_ID_1: Detector ID 1 (Non Agile in 80p80MHz supported devices, + * Agile detector in true 160MHz supported devices). + * @DETECTOR_ID_2: Detector ID 2 (Agile detector in 80p80MHZ supported devices). + * @AGILE_DETECTOR_ID_TRUE_160MHZ: Agile detector ID in true 160MHz devices. + * @AGILE_DETECTOR_ID_80p80: Agile detector ID in 80p80MHz supported devices. + * @DETECTOR_ID_MAX: Maximum detector ID value. + */ +enum detector_id { + DETECTOR_ID_0, + DETECTOR_ID_1, + DETECTOR_ID_2, + AGILE_DETECTOR_ID_TRUE_160MHZ = DETECTOR_ID_1, + AGILE_DETECTOR_ID_80P80 = DETECTOR_ID_2, + DETECTOR_ID_MAX, +}; /** * struct dfs_pulseparams - DFS pulse param structure. @@ -1084,6 +1098,7 @@ struct dfs_mode_switch_defer_params { * defer timer running. * @dfs_defer_params: DFS deferred event parameters (allocated * only for the duration of defer alone). + * @dfs_agile_detector_id: Agile detector ID for the DFS object. */ struct wlan_dfs { uint32_t dfs_debug_mask; @@ -1248,6 +1263,7 @@ struct wlan_dfs { bool dfs_allow_hw_pulses; #endif struct dfs_mode_switch_defer_params dfs_defer_params; + uint8_t dfs_agile_detector_id; }; #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) @@ -2828,4 +2844,41 @@ void dfs_complete_deferred_tasks(struct wlan_dfs *dfs); * Return: void. */ void dfs_process_cac_completion(struct wlan_dfs *dfs); + +#ifdef WLAN_DFS_TRUE_160MHZ_SUPPORT +/** + * dfs_is_true_160mhz_supported() - Find if true 160MHz is supported. + * @dfs: Pointer to wlan_dfs object. + * + * Return: True if true 160MHz is supported, else false. + */ +bool dfs_is_true_160mhz_supported(struct wlan_dfs *dfs); + +/** + * dfs_is_restricted_80p80mhz_supported() - Find if restricted 80p80mhz is + * supported. + * @dfs: Pointer to wlan_dfs object. + * + * Return: True if restricted 160MHz is supported, else false. + */ +bool dfs_is_restricted_80p80mhz_supported(struct wlan_dfs *dfs); +#else +static inline bool dfs_is_true_160mhz_supported(struct wlan_dfs *dfs) +{ + return false; +} + +static inline bool dfs_is_restricted_80p80mhz_supported(struct wlan_dfs *dfs) +{ + return false; +} +#endif /* WLAN_DFS_TRUE_160MHZ_SUPPORT */ + +/** + * dfs_get_agile_detector_id() - Find the Agile detector ID for given DFS. + * @dfs: Pointer to wlan_dfs object. + * + * Return: Agile detector value (uint8_t). + */ +uint8_t dfs_get_agile_detector_id(struct wlan_dfs *dfs); #endif /* _DFS_H_ */ diff --git a/umac/dfs/core/src/dfs_channel.h b/umac/dfs/core/src/dfs_channel.h index cb5a636c2fa0..4b7ec2b712fc 100644 --- a/umac/dfs/core/src/dfs_channel.h +++ b/umac/dfs/core/src/dfs_channel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018,2020 The Linux Foundation. All rights reserved. * Copyright (c) 2008 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for @@ -291,4 +291,8 @@ (WLAN_IS_CHAN_11AC_VHT80_80(_c) || \ WLAN_IS_CHAN_11AXA_HE80_80(_c)) +#define WLAN_IS_CHAN_MODE_165(_dfs, _c) \ + dfs_is_restricted_80p80mhz_supported(_dfs) && \ + WLAN_IS_CHAN_MODE_80_80(_c) + #endif /* _DFS_CHANNEL_H_ */ diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index e05d6be2c5fb..3384bd623c49 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -941,3 +941,29 @@ void dfs_complete_deferred_tasks(struct wlan_dfs *dfs) dfs->dfs_defer_params.is_cac_completed = false; } } + +#ifdef WLAN_DFS_TRUE_160MHZ_SUPPORT +bool dfs_is_true_160mhz_supported(struct wlan_dfs *dfs) +{ + struct wlan_objmgr_psoc *psoc = dfs->dfs_soc_obj->psoc; + struct wlan_lmac_if_target_tx_ops *tx_ops; + uint32_t target_type; + + target_type = lmac_get_target_type(dfs->dfs_pdev_obj); + tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops; + if (tx_ops->tgt_is_tgt_type_qcn9000) + return tx_ops->tgt_is_tgt_type_qcn9000(target_type); + return false; +} + +bool dfs_is_restricted_80p80mhz_supported(struct wlan_dfs *dfs) +{ + return wlan_psoc_nif_fw_ext_cap_get(dfs->dfs_soc_obj->psoc, + WLAN_SOC_RESTRICTED_80P80_SUPPORT); +} +#endif + +uint8_t dfs_get_agile_detector_id(struct wlan_dfs *dfs) +{ + return dfs->dfs_agile_detector_id; +} diff --git a/umac/dfs/core/src/misc/dfs_process_radar_found_ind.c b/umac/dfs/core/src/misc/dfs_process_radar_found_ind.c index efeb85a7f6b0..998ad5a3e9fa 100644 --- a/umac/dfs/core/src/misc/dfs_process_radar_found_ind.c +++ b/umac/dfs/core/src/misc/dfs_process_radar_found_ind.c @@ -337,7 +337,7 @@ dfs_compute_radar_found_cfreq(struct wlan_dfs *dfs, * Applicable to chips that have a separate agile radar detector * engine. */ - if (radar_found->detector_id == AGILE_DETECTOR_ID) { + if (radar_found->detector_id == dfs_get_agile_detector_id(dfs)) { *freq_center = dfs->dfs_agile_precac_freq_mhz; } else if (!radar_found->segment_id) { *freq_center = curchan->dfs_ch_mhz_freq_seg1; @@ -386,7 +386,7 @@ dfs_compute_radar_found_cfreq(struct wlan_dfs *dfs, * Applicable to chips that have a separate agile radar detector * engine. */ - if (radar_found->detector_id == AGILE_DETECTOR_ID) { + if (radar_found->detector_id == dfs_get_agile_detector_id(dfs)) { *freq_center = utils_dfs_chan_to_freq( dfs->dfs_agile_precac_freq); /* Radar found on primary segment by the HW. */ @@ -647,7 +647,7 @@ uint8_t dfs_get_bonding_channels_for_freq(struct wlan_dfs *dfs, uint16_t center_freq; uint8_t nchannels = 0; - if (detector_id == AGILE_DETECTOR_ID) + if (detector_id == dfs_get_agile_detector_id(dfs)) center_freq = dfs->dfs_agile_precac_freq_mhz; else if (!segment_id) center_freq = curchan->dfs_ch_mhz_freq_seg1; @@ -671,7 +671,7 @@ uint8_t dfs_get_bonding_channels_for_freq(struct wlan_dfs *dfs, freq_list[1] = center_freq + DFS_5GHZ_NEXT_CHAN_FREQ_OFFSET; } else if (WLAN_IS_CHAN_MODE_80(curchan) || WLAN_IS_CHAN_MODE_80_80(curchan) || - detector_id == AGILE_DETECTOR_ID) { + detector_id == dfs_get_agile_detector_id(dfs)) { /* If the current channel's bandwidth is 80/80+80/160Mhz, * the corresponding agile Detector's bandwidth will be 80Mhz. * Therefore, if radar is found on the agile detector find @@ -709,7 +709,7 @@ uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs, uint8_t center_chan; uint8_t nchannels = 0; - if (detector_id == AGILE_DETECTOR_ID) + if (detector_id == dfs_get_agile_detector_id(dfs)) center_chan = dfs->dfs_agile_precac_freq; else if (!segment_id) center_chan = curchan->dfs_ch_vhtop_ch_freq_seg1; @@ -744,7 +744,7 @@ uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs, channels[1] = center_chan + DFS_5GHZ_NEXT_CHAN_OFFSET; } else if (WLAN_IS_CHAN_MODE_80(curchan) || WLAN_IS_CHAN_MODE_80_80(curchan) || - detector_id == AGILE_DETECTOR_ID) { + detector_id == dfs_get_agile_detector_id(dfs)) { /* If the current channel's bandwidth is 80/80+80/160Mhz, * the corresponding agile Detector's bandwidth will be 80Mhz. * Therefore, if radar is found on the agile detector find @@ -1005,14 +1005,14 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, * different channel. */ if (!dfs_radarevent_basic_sanity(dfs, dfs_curchan) && - !(radar_found->detector_id == AGILE_DETECTOR_ID)) { + !(radar_found->detector_id == dfs_get_agile_detector_id(dfs))) { dfs_err(dfs, WLAN_DEBUG_DFS, "radar event on a non-DFS channel"); goto exit; } /* Sanity checks for radar on Agile detector */ - if (radar_found->detector_id == AGILE_DETECTOR_ID && + if (radar_found->detector_id == dfs_get_agile_detector_id(dfs) && (!dfs_is_agile_precac_enabled(dfs) || !dfs->dfs_agile_precac_freq_mhz)) { dfs_err(dfs, WLAN_DEBUG_DFS, @@ -1034,7 +1034,7 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, dfs_compute_radar_found_cfreq(dfs, radar_found, &freq_center); radarfound_freq = freq_center + radar_found->freq_offset; - if (radar_found->detector_id == AGILE_DETECTOR_ID) + if (radar_found->detector_id == dfs_get_agile_detector_id(dfs)) dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "Radar found on Agile detector freq=%d radar freq=%d", freq_center, radarfound_freq); @@ -1091,7 +1091,7 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, dfs->dfs_is_nol_ie_sent = false; (dfs->is_radar_during_precac || - radar_found->detector_id == AGILE_DETECTOR_ID) ? + radar_found->detector_id == dfs_get_agile_detector_id(dfs)) ? (dfs->dfs_is_rcsa_ie_sent = false) : (dfs->dfs_is_rcsa_ie_sent = true); if (dfs->dfs_use_nol_subchannel_marking) { @@ -1141,7 +1141,7 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, /* If radar is found on preCAC or Agile CAC, return here since * channel change is not required. */ - if (radar_found->detector_id == AGILE_DETECTOR_ID) + if (radar_found->detector_id == dfs_get_agile_detector_id(dfs)) goto exit; if (!dfs->dfs_is_offload_enabled && dfs->is_radar_found_on_secondary_seg) { 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 57259ab4a0a2..bb662148c237 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 @@ -903,6 +903,7 @@ struct wlan_lmac_if_dfs_tx_ops { * @tgt_is_tgt_type_qca9984: To check QCA9984 target type. * @tgt_is_tgt_type_qca9888: To check QCA9888 target type. * @tgt_is_tgt_type_adrastea: To check QCS40X target type. + * @tgt_is_tgt_type_qcn9000: To check QCN9000 (Pine) target type. * @tgt_get_tgt_type: Get target type * @tgt_get_tgt_version: Get target version * @tgt_get_tgt_revision: Get target revision @@ -913,6 +914,7 @@ struct wlan_lmac_if_target_tx_ops { bool (*tgt_is_tgt_type_qca9984)(uint32_t); bool (*tgt_is_tgt_type_qca9888)(uint32_t); bool (*tgt_is_tgt_type_adrastea)(uint32_t); + bool (*tgt_is_tgt_type_qcn9000)(uint32_t); uint32_t (*tgt_get_tgt_type)(struct wlan_objmgr_psoc *psoc); uint32_t (*tgt_get_tgt_version)(struct wlan_objmgr_psoc *psoc); uint32_t (*tgt_get_tgt_revision)(struct wlan_objmgr_psoc *psoc);