diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3469e39407..5c56e69e6b 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -3124,4 +3124,15 @@ bool hdd_is_cli_iface_up(struct hdd_context *hdd_ctx); */ void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting); +/** + * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface. + * @adapter: Handle to adapter + * @chan: Monitor mode channel + * @bandwidth: Capture channel bandwidth + * + * Return: 0 on success else error code. + */ +int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, + uint32_t bandwidth); + #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/inc/wlan_hdd_wext.h b/core/hdd/inc/wlan_hdd_wext.h index 07b6313551..9f423bcacc 100644 --- a/core/hdd/inc/wlan_hdd_wext.h +++ b/core/hdd/inc/wlan_hdd_wext.h @@ -329,17 +329,6 @@ struct iw_request_info; int hdd_check_private_wext_control(struct hdd_context *hdd_ctx, struct iw_request_info *info); -/** - * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface. - * @adapter: Handle to adapter - * @chan: Monitor mode channel - * @bandwidth: Capture channel bandwidth - * - * Return: 0 on success else error code. - */ -int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, - uint32_t bandwidth); - /** * hdd_crash_inject() - Inject a crash * @adapter: Adapter upon which the command was received diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d56a0c1fec..1ad3d14012 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5808,6 +5808,57 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid, } #endif +int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, + uint32_t bandwidth) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + 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->hHal; + struct qdf_mac_addr bssid; + struct csr_roam_profile roam_profile; + struct ch_params ch_params; + + if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { + hdd_err("Not supported, device is not in monitor mode"); + return -EINVAL; + } + + hdd_debug("Set monitor mode Channel %d", chan); + qdf_mem_zero(&roam_profile, sizeof(roam_profile)); + roam_profile.ChannelInfo.ChannelList = &ch_info->channel; + roam_profile.ChannelInfo.numOfChannels = 1; + roam_profile.phyMode = ch_info->phy_mode; + roam_profile.ch_params.ch_width = bandwidth; + hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); + + qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes, + QDF_MAC_ADDR_SIZE); + + ch_params.ch_width = bandwidth; + wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, chan, 0, &ch_params); + if (ch_params.ch_width == CH_WIDTH_INVALID) { + hdd_err("Invalid capture channel or bandwidth for a country"); + return -EINVAL; + } + if (wlan_hdd_change_hw_mode_for_given_chnl(adapter, chan, + POLICY_MGR_UPDATE_REASON_SET_OPER_CHAN)) { + hdd_err("Failed to change hw mode"); + return -EINVAL; + } + + status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, + &roam_profile); + if (status) { + hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", + status); + } + + adapter->mon_chan = chan; + adapter->mon_bandwidth = bandwidth; + return qdf_status_to_os_return(status); +} QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) { diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 279956afd6..13c44219ba 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -9212,58 +9212,6 @@ static int iw_set_band_config(struct net_device *dev, return ret; } -int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, - uint32_t bandwidth) -{ - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - 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->hHal; - struct qdf_mac_addr bssid; - struct csr_roam_profile roam_profile; - struct ch_params ch_params; - - if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) { - hdd_err("Not supported, device is not in monitor mode"); - return -EINVAL; - } - - hdd_debug("Set monitor mode Channel %d", chan); - qdf_mem_zero(&roam_profile, sizeof(roam_profile)); - roam_profile.ChannelInfo.ChannelList = &ch_info->channel; - roam_profile.ChannelInfo.numOfChannels = 1; - roam_profile.phyMode = ch_info->phy_mode; - roam_profile.ch_params.ch_width = bandwidth; - hdd_select_cbmode(adapter, chan, &roam_profile.ch_params); - - qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes, - QDF_MAC_ADDR_SIZE); - - ch_params.ch_width = bandwidth; - wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, chan, 0, &ch_params); - if (ch_params.ch_width == CH_WIDTH_INVALID) { - hdd_err("Invalid capture channel or bandwidth for a country"); - return -EINVAL; - } - if (wlan_hdd_change_hw_mode_for_given_chnl(adapter, chan, - POLICY_MGR_UPDATE_REASON_SET_OPER_CHAN)) { - hdd_err("Failed to change hw mode"); - return -EINVAL; - } - - status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params, - &roam_profile); - if (status) { - hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", - status); - } - - adapter->mon_chan = chan; - adapter->mon_bandwidth = bandwidth; - return qdf_status_to_os_return(status); -} - static int printk_adapter(void *priv, const char *fmt, ...) { int ret;