diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 63d4eb3b029c..b27a8bc9201c 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -2482,6 +2482,14 @@ void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos) iface->pause_bitmap &= ~(1 << bit_pos); } +/** + * chanmode_to_chanwidth() - get channel width through channel mode + * @chanmode: channel phy mode + * + * Return: channel width + */ +wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode); + /** * wma_process_roaming_config() - process roam request * @wma_handle: wma handle diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index cec559a2b33e..bb8a4a14dd14 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -1000,7 +1000,7 @@ static const wmi_channel_width mode_to_width[MODE_MAX] = { * * Return: channel width */ -static wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode) +wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode) { wmi_channel_width chan_width; diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 88c566eea7d2..40c200488b7e 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -2967,8 +2967,19 @@ int wma_mgmt_tx_bundle_completion_handler(void *handle, uint8_t *buf, void wma_process_update_opmode(tp_wma_handle wma_handle, tUpdateVHTOpMode *update_vht_opmode) { - WMA_LOGD("%s: opMode = %d", __func__, update_vht_opmode->opMode); + struct wma_txrx_node *iface; + wmi_channel_width ch_width; + iface = &wma_handle->interfaces[update_vht_opmode->smesessionId]; + ch_width = chanmode_to_chanwidth(iface->chanmode); + + if (ch_width < update_vht_opmode->opMode) { + WMA_LOGE("%s: Invalid peer bw update %d, self bw %d", + __func__, update_vht_opmode->opMode, + ch_width); + return; + } + WMA_LOGD("%s: opMode = %d", __func__, update_vht_opmode->opMode); wma_set_peer_param(wma_handle, update_vht_opmode->peer_mac, WMI_PEER_CHWIDTH, update_vht_opmode->opMode, update_vht_opmode->smesessionId);