|
@@ -6046,14 +6046,25 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
|
|
|
struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
|
|
struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info;
|
|
|
QDF_STATUS status;
|
|
|
+ tHalHandle hal_hdl = hdd_ctx->mac_handle;
|
|
|
struct qdf_mac_addr bssid;
|
|
|
struct csr_roam_profile roam_profile;
|
|
|
struct ch_params ch_params;
|
|
|
+ eConnectionState connstate;
|
|
|
|
|
|
- if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) {
|
|
|
- hdd_err("Not supported, device is not in monitor mode");
|
|
|
+ if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE &&
|
|
|
+ adapter->device_mode != QDF_STA_MODE) {
|
|
|
+ hdd_err("Not supported, device is not in monitor mode or sta mission mode");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
+ if (adapter->device_mode == QDF_STA_MODE &&
|
|
|
+ hdd_ctx->config->enable_change_channel_bandwidth) {
|
|
|
+ connstate = sta_ctx->conn_info.connState;
|
|
|
+ if (eConnectionState_Associated == connstate ||
|
|
|
+ eConnectionState_Connecting == connstate) {
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/* Validate Channel */
|
|
|
if (!WLAN_REG_IS_24GHZ_CH(chan) && !WLAN_REG_IS_5GHZ_CH(chan)) {
|
|
@@ -6088,7 +6099,16 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
|
|
|
roam_profile.phyMode = ch_info->phy_mode;
|
|
|
roam_profile.ch_params.ch_width = bandwidth;
|
|
|
hdd_select_cbmode(adapter, chan, &roam_profile.ch_params);
|
|
|
-
|
|
|
+ if (hdd_ctx->config->enable_change_channel_bandwidth &&
|
|
|
+ (!sme_find_session_by_bssid(hal_hdl, adapter->mac_addr.bytes))) {
|
|
|
+ status = sme_create_mon_session(hal_hdl,
|
|
|
+ adapter->mac_addr.bytes);
|
|
|
+ if (status != QDF_STATUS_SUCCESS) {
|
|
|
+ hdd_err("Status: %d Failed to create session.",
|
|
|
+ status);
|
|
|
+ return qdf_status_to_os_return(status);
|
|
|
+ }
|
|
|
+ }
|
|
|
qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
|
|
|
QDF_MAC_ADDR_SIZE);
|
|
|
|