From 1a18faf9e8faa5ee290877c96fed276892ec3540 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Mon, 16 Jul 2018 06:39:29 -0400 Subject: [PATCH] qcacmn: Limit concurrency of STA(WAPI) When STA role is coexisting with other sessions(P2P, SAP or IBSS), WAPI encryption mode is not allowed. Add a new API to check if the connection/start request should be rejected when: 1) A STA with WAPI encryption is to be connected while there is at least one concurrent session already running. 2) A new session is to be started while there is already a STA connection with WAPI encryption enabled. Change-Id: Idf0d346138eeda339254535f1f7131fda4a5086a CRs-Fixed: 2290549 --- inc/wlan_policy_mgr_api.h | 5 +++++ src/wlan_policy_mgr_get_set_utils.c | 28 ++++++++++++++++++++++++++++ src/wlan_policy_mgr_init_deinit.c | 2 ++ 3 files changed, 35 insertions(+) diff --git a/inc/wlan_policy_mgr_api.h b/inc/wlan_policy_mgr_api.h index f9d38dc4c9b6..7dc6d12ba209 100644 --- a/inc/wlan_policy_mgr_api.h +++ b/inc/wlan_policy_mgr_api.h @@ -871,6 +871,10 @@ struct policy_mgr_sme_cbacks { * SAP * @get_mode_for_non_connected_vdev: Get the mode for a non * connected vdev + * @hdd_get_device_mode: Get QDF_OPMODE type for session id (vdev id) + * @hdd_wapi_security_sta_exist: Get whether wapi encription station existing + * or not. Some hw doesn't support WAPI encryption concurrency with other + * encryption type. */ struct policy_mgr_hdd_cbacks { void (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc, @@ -885,6 +889,7 @@ struct policy_mgr_hdd_cbacks { struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); enum QDF_OPMODE (*hdd_get_device_mode)(uint32_t session_id); + bool (*hdd_wapi_security_sta_exist)(void); }; diff --git a/src/wlan_policy_mgr_get_set_utils.c b/src/wlan_policy_mgr_get_set_utils.c index 41d961f120ab..9079e721b02a 100644 --- a/src/wlan_policy_mgr_get_set_utils.c +++ b/src/wlan_policy_mgr_get_set_utils.c @@ -1544,6 +1544,29 @@ static bool policy_mgr_is_sub_20_mhz_enabled(struct wlan_objmgr_psoc *psoc) return pm_ctx->user_cfg.sub_20_mhz_enabled; } +/** + * policy_mgr_check_privacy_for_new_conn() - Check privacy mode concurrency + * @pm_ctx: policy_mgr_psoc_priv_obj policy mgr context + * + * This routine is called to check vdev security mode allowed in concurrency. + * At present, WAPI security mode is not allowed to run concurrency with any + * other vdev. + * + * Return: true - allow + */ +static bool policy_mgr_check_privacy_for_new_conn( + struct policy_mgr_psoc_priv_obj *pm_ctx) +{ + if (!pm_ctx->hdd_cbacks.hdd_wapi_security_sta_exist) + return true; + + if (pm_ctx->hdd_cbacks.hdd_wapi_security_sta_exist() && + (policy_mgr_get_connection_count(pm_ctx->psoc) > 0)) + return false; + + return true; +} + bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, uint8_t channel, @@ -1731,6 +1754,11 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); } + if (!policy_mgr_check_privacy_for_new_conn(pm_ctx)) { + policy_mgr_err("Don't allow new conn when wapi security conn existing"); + goto done; + } + status = true; done: diff --git a/src/wlan_policy_mgr_init_deinit.c b/src/wlan_policy_mgr_init_deinit.c index 83528a963e27..322de079032d 100644 --- a/src/wlan_policy_mgr_init_deinit.c +++ b/src/wlan_policy_mgr_init_deinit.c @@ -581,6 +581,8 @@ QDF_STATUS policy_mgr_register_hdd_cb(struct wlan_objmgr_psoc *psoc, hdd_cbacks->get_mode_for_non_connected_vdev; pm_ctx->hdd_cbacks.hdd_get_device_mode = hdd_cbacks->hdd_get_device_mode; + pm_ctx->hdd_cbacks.hdd_wapi_security_sta_exist = + hdd_cbacks->hdd_wapi_security_sta_exist; return QDF_STATUS_SUCCESS; }