From ba856a8978be3af4ea481639c8e1e2d222feb7d3 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Tue, 29 Dec 2020 12:03:04 +0530 Subject: [PATCH] qcacld-3.0: Update he and ht rate flags correctly Currently driver does not update he and ht rate flags correctly in wma as rate flags should include all the subsets of the lower rate sets, which is not the case today and driver only updates the higher rate flag. Because of which it leads to invalid computation of txrate at the kernel. To address this issue, update he and ht rate flags correctly in wma. change-Id: I6ec68af1f75650990384efbd61536042329665b2 CRs-Fixed: 2837245 --- core/wma/inc/wma_internal.h | 18 +++++++++++++- core/wma/src/wma_data.c | 48 +++++++++++++++++++++++++------------ core/wma/src/wma_dev_if.c | 19 ++++----------- core/wma/src/wma_utils.c | 5 ++-- 4 files changed, 57 insertions(+), 33 deletions(-) diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index a3ed0d324d3c..4a2d0319b758 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 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 @@ -969,6 +969,22 @@ void wma_set_bss_rate_flags(tp_wma_handle wma, uint8_t vdev_id, */ enum tx_rate_info wma_get_vht_rate_flags(enum phy_ch_width ch_width); +/** + * wma_get_ht_rate_flags() - Return the HT rate flags corresponding to the BW + * @ch_width: BW for which rate flags is required + * + * Return: Rate flags corresponding to ch_width + */ +enum tx_rate_info wma_get_ht_rate_flags(enum phy_ch_width ch_width); + +/** + * wma_get_he_rate_flags() - Return the HE rate flags corresponding to the BW + * @ch_width: BW for which rate flags is required + * + * Return: Rate flags corresponding to ch_width + */ +enum tx_rate_info wma_get_he_rate_flags(enum phy_ch_width ch_width); + int32_t wmi_unified_send_txbf(tp_wma_handle wma, tpAddStaParams params); /** diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index 61a23e4bf178..6082f2d4de32 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 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 @@ -771,16 +771,7 @@ static QDF_STATUS wma_set_bss_rate_flags_he(enum tx_rate_info *rate_flags, if (!add_bss->he_capable) return QDF_STATUS_E_NOSUPPORT; - /*extend TX_RATE_HE160 in future*/ - if (add_bss->ch_width == CH_WIDTH_160MHZ || - add_bss->ch_width == CH_WIDTH_80P80MHZ) - *rate_flags |= TX_RATE_HE160; - else if (add_bss->ch_width == CH_WIDTH_80MHZ) - *rate_flags |= TX_RATE_HE80; - else if (add_bss->ch_width) - *rate_flags |= TX_RATE_HE40; - else - *rate_flags |= TX_RATE_HE20; + *rate_flags |= wma_get_he_rate_flags(add_bss->ch_width); wma_debug("he_capable %d rate_flags 0x%x", add_bss->he_capable, *rate_flags); @@ -823,6 +814,36 @@ enum tx_rate_info wma_get_vht_rate_flags(enum phy_ch_width ch_width) return rate_flags; } +enum tx_rate_info wma_get_ht_rate_flags(enum phy_ch_width ch_width) +{ + enum tx_rate_info rate_flags = 0; + + if (ch_width) + rate_flags |= TX_RATE_HT40 | TX_RATE_HT20; + else + rate_flags |= TX_RATE_HT20; + + return rate_flags; +} + +enum tx_rate_info wma_get_he_rate_flags(enum phy_ch_width ch_width) +{ + enum tx_rate_info rate_flags = 0; + + if (ch_width == CH_WIDTH_160MHZ || + ch_width == CH_WIDTH_80P80MHZ) + rate_flags |= TX_RATE_HE160 | TX_RATE_HE80 | TX_RATE_HE40 | + TX_RATE_HE20; + else if (ch_width == CH_WIDTH_80MHZ) + rate_flags |= TX_RATE_HE80 | TX_RATE_HE40 | TX_RATE_HE20; + else if (ch_width) + rate_flags |= TX_RATE_HE40 | TX_RATE_HE20; + else + rate_flags |= TX_RATE_HE20; + + return rate_flags; +} + void wma_set_bss_rate_flags(tp_wma_handle wma, uint8_t vdev_id, struct bss_params *add_bss) { @@ -846,10 +867,7 @@ void wma_set_bss_rate_flags(tp_wma_handle wma, uint8_t vdev_id, } /* avoid to conflict with htCapable flag */ else if (add_bss->htCapable) { - if (add_bss->ch_width) - *rate_flags |= TX_RATE_HT40; - else - *rate_flags |= TX_RATE_HT20; + *rate_flags |= wma_get_ht_rate_flags(add_bss->ch_width); } } diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 88c65c9d5ca4..dc54886ad7dc 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 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 @@ -973,22 +973,11 @@ void wma_update_rate_flags_after_vdev_restart(tp_wma_handle wma, bss_phymode = des_chan->ch_phymode; if (IS_WLAN_PHYMODE_HE(bss_phymode)) { - if (des_chan->ch_width == CH_WIDTH_160MHZ || - des_chan->ch_width == CH_WIDTH_80P80MHZ) - rate_flags |= TX_RATE_HE160; - else if (des_chan->ch_width == CH_WIDTH_80MHZ) - rate_flags |= TX_RATE_HE80; - else if (des_chan->ch_width) - rate_flags |= TX_RATE_HE40; - else - rate_flags |= TX_RATE_HE20; + rate_flags = wma_get_he_rate_flags(des_chan->ch_width); } else if (IS_WLAN_PHYMODE_VHT(bss_phymode)) { - rate_flags |= wma_get_vht_rate_flags(des_chan->ch_width); + rate_flags = wma_get_vht_rate_flags(des_chan->ch_width); } else if (IS_WLAN_PHYMODE_HT(bss_phymode)) { - if (des_chan->ch_width) - rate_flags |= TX_RATE_HT40; - else - rate_flags |= TX_RATE_HT20; + rate_flags = wma_get_ht_rate_flags(des_chan->ch_width); } else { rate_flags = TX_RATE_LEGACY; } diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 9bcb18863c64..3f8369f8833f 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 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 @@ -421,7 +421,8 @@ static uint16_t wma_match_he_rate(uint16_t raw_rate, guard_interval); if (match_rate) { - *mcs_rate_flag &= ~TX_RATE_HE80; + *mcs_rate_flag &= ~(TX_RATE_HE80 | + TX_RATE_HE160); goto rate_found; } }