qcacld-2.0: Refine the MGMT rate valid check function
1. CCK rate should not allowed in 5G mode
2. Avoid configure 2 stream rates to send MGMT packet
Change-Id: Id222bc5c41264ba802a43a02d333f16578bc4a5d
CRs-Fixed: 2182955
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index f99ad45..4934144 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -10382,10 +10382,11 @@
/**
* wma_verify_rate_code() - verify if rate code is valid.
* @rate_code: rate code
+ * @curr_band: current band that device working on
*
* Return: verify result
*/
-static bool wma_verify_rate_code(u_int32_t rate_code)
+static bool wma_verify_rate_code(u_int32_t rate_code, uint8_t curr_band)
{
uint8_t preamble, nss, rate;
bool valid = true;
@@ -10396,7 +10397,7 @@
switch (preamble) {
case WMI_RATE_PREAMBLE_CCK:
- if (nss != 0 || rate > 3)
+ if (nss != 0 || rate > 3 || curr_band == VOS_BAND_5GHZ)
valid = false;
break;
case WMI_RATE_PREAMBLE_OFDM:
@@ -10404,11 +10405,11 @@
valid = false;
break;
case WMI_RATE_PREAMBLE_HT:
- if (nss > 1 || rate > 7)
+ if (nss != 0 || rate > 7)
valid = false;
break;
case WMI_RATE_PREAMBLE_VHT:
- if (nss > 1 || rate > 9)
+ if (nss != 0 || rate > 9)
valid = false;
break;
default:
@@ -10434,6 +10435,8 @@
uint32_t cfg_val;
int ret;
uint32_t per_band_mgmt_tx_rate = 0;
+ uint32_t current_chan;
+ uint8_t current_band;
struct sAniSirGlobal *mac =
(struct sAniSirGlobal*)vos_get_context(VOS_MODULE_ID_PE,
wma->vos_context);
@@ -10443,10 +10446,13 @@
return;
}
+ current_chan = vos_freq_to_chan(wma->interfaces[vdev_id].mhz);
+ current_band = vos_chan_to_band(current_chan);
+
if (wlan_cfgGetInt(mac, WNI_CFG_RATE_FOR_TX_MGMT,
&cfg_val) == eSIR_SUCCESS) {
if ((cfg_val == WNI_CFG_RATE_FOR_TX_MGMT_STADEF) ||
- !wma_verify_rate_code(cfg_val)) {
+ !wma_verify_rate_code(cfg_val, current_band)) {
WMA_LOGE("invalid rate code, ignore.");
} else {
ret = wmi_unified_vdev_set_param_send(
@@ -10466,7 +10472,7 @@
if (wlan_cfgGetInt(mac, WNI_CFG_RATE_FOR_TX_MGMT_2G,
&cfg_val) == eSIR_SUCCESS) {
if ((cfg_val == WNI_CFG_RATE_FOR_TX_MGMT_2G_STADEF) ||
- !wma_verify_rate_code(cfg_val)) {
+ !wma_verify_rate_code(cfg_val, current_band)) {
per_band_mgmt_tx_rate &=
~(1 << TX_MGMT_RATE_2G_ENABLE_OFFSET);
} else {
@@ -10482,7 +10488,7 @@
if (wlan_cfgGetInt(mac, WNI_CFG_RATE_FOR_TX_MGMT_5G,
&cfg_val) == eSIR_SUCCESS) {
if ((cfg_val == WNI_CFG_RATE_FOR_TX_MGMT_5G_STADEF) ||
- !wma_verify_rate_code(cfg_val)) {
+ !wma_verify_rate_code(cfg_val, current_band)) {
per_band_mgmt_tx_rate &=
~(1 << TX_MGMT_RATE_5G_ENABLE_OFFSET);
} else {