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
This commit is contained in:
Liangwei Dong 2018-07-16 06:39:29 -04:00 • committed by nshrivas
commit 1a18faf9e8
3 changed files with 35 additions and 0 deletions

View file

@ -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);
};

View file

@ -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:

View file

@ -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;
}