From 3a9b82683cbe3f09cbae8826ce71a1a907d38ca2 Mon Sep 17 00:00:00 2001 From: Vignesh U Date: Wed, 30 Sep 2020 12:57:37 +0530 Subject: [PATCH] qca-wifi: Introduce radar param translation for 160/165Mhz Agile channel The radar parameter received from FW for Pine is based on the 160MHz channel center. In Host a preprocessing to convert this radar parameters based on 160MHz channel center into parameters based on 80MHz channel center is done. This translation is present for the current channel but is absent for the agile channel. Also, for the 165MHz agile channel, the radar parameters are always sent to host based on the left 80MHz center frequency 5690MHz. Introduce a radar parameter translation function for 160/165MHz Agile channel such that 1) If the radar hit frequency is left to the center of 160MHz center frequency, then the segment id should be primary segment. The offset frequeny that was with respect to the 160MHz channel center should be converted into offset frequency based on the left 80MHz center by adding 40MHz on the offset received. 2) If the radar hit frequency is right to the center of 160MHz center frequency, then the segment id should besecondary segment. The offset frequeny that was with respect to the 160MHz channel center should be converted offset frequency based on the right 80MHz center by subtracting 40MHz on the offset received. 3) If the radar hit frequency is on the left 80MHz segment of the 165MHz channel then do nothing because, the radar paramters are sent by FW with respect to the left 80MHz center frequency of the 165MHz channel. 4) If the radar hit frequency is on the right 80MHz segment of the 165MHz channel then the segment id should be secondary segment id and the offset should be converted to be based on the right 80MHz center frequency 5775MHz by subtracting 85MHz. Change-Id: I47471e65c5831c0aa9c2c36338021a55d4dc7c7b CRs-Fixed: 2784515 --- umac/dfs/core/src/misc/dfs_zero_cac.c | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/umac/dfs/core/src/misc/dfs_zero_cac.c b/umac/dfs/core/src/misc/dfs_zero_cac.c index 3192af4971..b4721a4130 100644 --- a/umac/dfs/core/src/misc/dfs_zero_cac.c +++ b/umac/dfs/core/src/misc/dfs_zero_cac.c @@ -5174,3 +5174,47 @@ exit: return status; } #endif +#if defined(WLAN_DFS_TRUE_160MHZ_SUPPORT) && defined(WLAN_DFS_FULL_OFFLOAD) +void dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs, + struct radar_found_info *r_info) +{ + if (dfs->dfs_precac_chwidth == CH_WIDTH_160MHZ) { + if (r_info->freq_offset > 0) { + /* + * If the radar hit frequency is right to the center of + * 160MHz center frequency, then the segment id should + * be secondary segment. The offset frequeny that was + * with respect to the 160MHz channel center should be + * converted offset frequency based on the right 80MHz + * center by subtracting 40MHz on the offset received. + */ + + r_info->segment_id = SECONDARY_SEG; + r_info->freq_offset -= DFS_160MHZ_SECOND_SEG_OFFSET; + } else { + /* + * If the radar hit frequency is left to the center of + * 160MHz center frequency, then the segment id should + * be primary segment. The offset frequeny that was with + * respect to the 160MHz channel center should be + * converted into offset frequency based on the left + * 80MHz center by adding 40MHz on the offset received. + */ + r_info->segment_id = PRIMARY_SEG; + r_info->freq_offset += DFS_160MHZ_SECOND_SEG_OFFSET; + } + } else if (IS_HOST_AGILE_CURCHAN_165MHZ(dfs)) { + if (r_info->freq_offset > DFS_160MHZ_SECOND_SEG_OFFSET) { + /* + * If the radar hit frequency is on the right 80MHz + * segment of the 165MHz channel then the segment id + * should be secondary segment id and the offset should + * be converted to be based on the right 80MHz center + * frequency 5775MHz by subtracting 85MHz. + */ + r_info->segment_id = SECONDARY_SEG; + r_info->freq_offset -= DFS_80P80MHZ_SECOND_SEG_OFFSET; + } + } +} +#endif