diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index d9374935a2..4fad24bc91 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -31,6 +31,25 @@ #define ASSEMBLE_RATECODE_V1(_pream, _nss, _rate) \ (((1) << 28) | ((_pream) << 8) | ((_nss) << 5) | (_rate)) +/* This macro is used to extract the rate from the rate_code as first four bits + * in rate_code represents the rate, next 3 bits represents the nss and + * next 2 bits represents preamble. + */ +#define RATECODE_V1_RIX_MASK 0xf + +/* This macro is used to extract preamble from the rate_code as first 4 bits + * in rate_code represents the rate, next 3 bits represents the nss and + * next 2 bits represents preamble. + */ +#define RATECODE_V1_PREAMBLE_OFFSET (4 + 3) + +/* This macro is used to extract NSS from the rate_code as first 4 bits + * in rate_code represents the rate, next 3 bits represents the NSS and + * next 2 bits represents preamble. + */ +#define RATECODE_V1_NSS_OFFSET 0x4 +#define RATECODE_V1_NSS_MASK 0x7 + #ifdef FEATURE_SET /** * wlan_mlme_get_feature_info() - Get mlme features diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index a998799e7d..cc46893d8f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7316,8 +7316,7 @@ static uint16_t hdd_get_data_rate_from_rate_mask(struct wiphy *wiphy, sband_bitrates = sband->bitrates; sband_n_bitrates = sband->n_bitrates; for (i = 0; i < sband_n_bitrates; i++) { - if (bit_rate_mask->control[band].legacy == - sband_bitrates[i].hw_value) + if (bit_rate_mask->control[band].legacy == (1 << i)) return sband_bitrates[i].bitrate; } } diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index bdf50f487c..6fc0869ddb 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -3223,6 +3223,33 @@ enum mlme_bcn_tx_rate_code wma_get_bcn_rate_code(uint16_t rate) } } +#ifdef WLAN_BCN_RATECODE_ENABLE +/** + * wma_update_beacon_tx_rate_code() - Update bcn_tx_rate_code + * @mlme_obj: pointer to mlme object + * + * Return: none + */ +static void wma_update_beacon_tx_rate_code(struct vdev_mlme_obj *mlme_obj) +{ + uint8_t preamble, nss, rix; + uint32_t rate_code; + + rate_code = mlme_obj->mgmt.rate_info.bcn_tx_rate; + + rix = rate_code & RATECODE_V1_RIX_MASK; + nss = (rate_code >> RATECODE_V1_NSS_OFFSET) & RATECODE_V1_NSS_MASK; + preamble = rate_code >> RATECODE_V1_PREAMBLE_OFFSET; + + mlme_obj->mgmt.rate_info.bcn_tx_rate_code = + wlan_mlme_assemble_rate_code(preamble, nss, rix); +} +#else +static void wma_update_beacon_tx_rate_code(struct vdev_mlme_obj *mlme_obj) +{ +} +#endif + QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart) { tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); @@ -3313,6 +3340,7 @@ QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart) */ mlme_obj->mgmt.rate_info.bcn_tx_rate = wma_get_bcn_rate_code(mlme_obj->mgmt.rate_info.bcn_tx_rate); + wma_update_beacon_tx_rate_code(mlme_obj); } if (!restart) {