From f7662e5fed34ad932ead2879ae1ca361d93104ec Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Mon, 5 Feb 2018 09:04:07 -0800 Subject: [PATCH] qcacld-3.0: Validate opmode update req before sending to FW Check the current vdev supported bandwidth values agianst peer opemode update value and if the peer opmode value is greater than current supported value then do not send the opmode update request to FW. Change-Id: I8f360d769b5aafb90061a6a9d18f1f8062e3534e CRs-Fixed: 2174050 --- core/wma/inc/wma.h | 8 ++++++++ core/wma/src/wma_dev_if.c | 2 +- core/wma/src/wma_mgmt.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) 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);