Browse Source

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
Ashish Kumar Dhanotiya 4 years ago
parent
commit
381b94ab89
4 changed files with 57 additions and 33 deletions
  1. 17 1
      core/wma/inc/wma_internal.h
  2. 33 15
      core/wma/src/wma_data.c
  3. 4 15
      core/wma/src/wma_dev_if.c
  4. 3 2
      core/wma/src/wma_utils.c

+ 17 - 1
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
@@ -951,6 +951,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);
 
 /**

+ 33 - 15
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);
 		}
 	}
 

+ 4 - 15
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
@@ -971,22 +971,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;
 	}

+ 3 - 2
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;
 				}
 			}