diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index da8e16e652b2f..883ae15ae0701 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2736,6 +2736,14 @@ void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist, int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid, int8_t *rssi, int8_t *snr); +/** + * hdd_reset_limit_off_chan() - reset limit off-channel command parameters + * @adapter - HDD adapter + * + * Return: 0 on success and non zero value on failure + */ +int hdd_reset_limit_off_chan(struct hdd_adapter *adapter); + #if defined(WLAN_FEATURE_FILS_SK) && defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) /** * hdd_clear_fils_connection_info: API to clear fils info from roam profile and diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index ce7818f47b2a6..2aaa54527eb10 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1777,6 +1777,9 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, wlan_hdd_clear_link_layer_stats(adapter); /* Unblock anyone waiting for disconnect to complete */ complete(&adapter->disconnect_comp_var); + + hdd_reset_limit_off_chan(adapter); + hdd_print_bss_info(sta_ctx); return status; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d2ef4c0f4d3e8..26c97d13317ca 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -12620,30 +12620,6 @@ int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid, return 0; } -/** - * hdd_send_limit_off_chan_cmd() - send limit off-channel command parameters - * @param - pointer to sir_limit_off_chan - * - * Return: 0 on success and non zero value on failure - */ -static int hdd_send_limit_off_chan_cmd(struct sir_limit_off_chan *param) -{ - struct scheduler_msg msg = {0}; - - msg.type = WMA_SET_LIMIT_OFF_CHAN; - msg.reserved = 0; - msg.bodyptr = param; - - if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, - &msg))) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("Not able to post WMA_SET_LIMIT_OFF_CHAN to WMA")); - return QDF_STATUS_E_FAILURE; - } - - return 0; -} - /** * hdd_set_limit_off_chan_for_tos() - set limit off-channel command parameters * @adapter - HDD adapter @@ -12657,9 +12633,11 @@ int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos, bool is_tos_active) { int ac_bit; - struct sir_limit_off_chan *cmd; struct hdd_context *hdd_ctx; + uint32_t max_off_chan_time = 0; + QDF_STATUS status; int ret; + tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); @@ -12669,12 +12647,6 @@ int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos, return ret; } - cmd = qdf_mem_malloc(sizeof(struct sir_limit_off_chan)); - if (!cmd) { - hdd_err("qdf_mem_malloc failed for limit off channel"); - return -ENOMEM; - } - ac_bit = limit_off_chan_tbl[tos][HDD_AC_BIT_INDX]; if (is_tos_active) @@ -12684,12 +12656,12 @@ int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos, if (adapter->active_ac) { if (adapter->active_ac & HDD_AC_VO_BIT) { - cmd->max_off_chan_time = + max_off_chan_time = limit_off_chan_tbl[TOS_VO][HDD_DWELL_TIME_INDX]; policy_mgr_set_cur_conc_system_pref(hdd_ctx->hdd_psoc, PM_LATENCY); } else if (adapter->active_ac & HDD_AC_VI_BIT) { - cmd->max_off_chan_time = + max_off_chan_time = limit_off_chan_tbl[TOS_VI][HDD_DWELL_TIME_INDX]; policy_mgr_set_cur_conc_system_pref(hdd_ctx->hdd_psoc, PM_LATENCY); @@ -12705,14 +12677,51 @@ int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos, hdd_ctx->config->conc_system_pref); } - cmd->vdev_id = adapter->sessionId; - cmd->is_tos_active = is_tos_active; - cmd->rest_time = hdd_ctx->config->nRestTimeConc; - cmd->skip_dfs_chans = true; + status = sme_send_limit_off_channel_params(hal, adapter->sessionId, + is_tos_active, max_off_chan_time, + hdd_ctx->config->nRestTimeConc, true); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("failed to set limit off chan params"); + ret = -EINVAL; + } - ret = hdd_send_limit_off_chan_cmd(cmd); - if (ret) - qdf_mem_free(cmd); + return ret; +} + +/** + * hdd_reset_limit_off_chan() - reset limit off-channel command parameters + * @adapter - HDD adapter + * + * Return: 0 on success and non zero value on failure + */ +int hdd_reset_limit_off_chan(struct hdd_adapter *adapter) +{ + struct hdd_context *hdd_ctx; + int ret; + QDF_STATUS status; + tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); + + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret < 0) + return ret; + + /* set the system preferece to default */ + policy_mgr_set_cur_conc_system_pref(hdd_ctx->hdd_psoc, + hdd_ctx->config->conc_system_pref); + + /* clear the bitmap */ + adapter->active_ac = 0; + + hdd_debug("reset ac_bitmap for session %hu active_ac %0x", + adapter->sessionId, adapter->active_ac); + + status = sme_send_limit_off_channel_params(hal, adapter->sessionId, + false, 0, 0, false); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("failed to reset limit off chan params"); + ret = -EINVAL; + } return ret; } diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 325cc99167118..ed78a3f2a4f12 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1771,4 +1771,22 @@ QDF_STATUS sme_process_msg_callback(tHalHandle hal, QDF_STATUS sme_set_bmiss_bcnt(uint32_t vdev_id, uint32_t first_cnt, uint32_t final_cnt); +/** + * sme_send_limit_off_channel_params() - send limit off channel parameters + * @hal: global hal handle + * @vdev_id: vdev id + * @is_tos_active: tos active or inactive + * @max_off_chan_time: max off channel time + * @rest_time: rest time + * @skip_dfs_chan: skip dfs channel + * + * This function sends command to WMA for setting limit off channel command + * parameters. + * + * Return: QDF_STATUS enumeration. + */ +QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id, + bool is_tos_active, uint32_t max_off_chan_time, + uint32_t rest_time, bool skip_dfs_chan); + #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 6e7e04e07a5de..65bcdcf797951 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16076,3 +16076,36 @@ QDF_STATUS sme_set_bmiss_bcnt(uint32_t vdev_id, uint32_t first_cnt, { return wma_config_bmiss_bcnt_params(vdev_id, first_cnt, final_cnt); } + +QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id, + bool is_tos_active, uint32_t max_off_chan_time, + uint32_t rest_time, bool skip_dfs_chan) +{ + struct sir_limit_off_chan *cmd; + struct scheduler_msg msg = {0}; + + cmd = qdf_mem_malloc(sizeof(*cmd)); + if (!cmd) { + sme_err("qdf_mem_malloc failed for limit off channel"); + return QDF_STATUS_E_NOMEM; + } + + cmd->vdev_id = vdev_id; + cmd->is_tos_active = is_tos_active; + cmd->max_off_chan_time = max_off_chan_time; + cmd->rest_time = rest_time; + cmd->skip_dfs_chans = skip_dfs_chan; + + msg.type = WMA_SET_LIMIT_OFF_CHAN; + msg.reserved = 0; + msg.bodyptr = cmd; + + if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, + &msg))) { + sme_err("Not able to post WMA_SET_LIMIT_OFF_CHAN to WMA"); + qdf_mem_free(cmd); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +}