qcacld-3.0: Add support to reject TWT setup incase of concurrency

Add support to reject TWT setup request if received when the below
mentioned concurrency scenario exists.

STA + SAP: SCC or MCC: Reject TWT setup
STA + P2P: SCC or MCC: Reject TWT setup

Change-Id: I5c4c2bcc032276a0b83b7a46a44dbf7933cda29f
CRs-Fixed: 2923726
This commit is contained in:
Srinivas Girigowda 2021-04-13 18:42:48 -07:00 • committed by snandini
commit 948e2bfa0a
3 changed files with 62 additions and 0 deletions

View file

@ -1637,6 +1637,20 @@ void policy_mgr_set_dual_mac_scan_config(struct wlan_objmgr_psoc *psoc,
void policy_mgr_set_dual_mac_fw_mode_config(struct wlan_objmgr_psoc *psoc,
uint8_t dbs, uint8_t dfs);
/**
* policy_mgr_is_scc_with_this_vdev_id() - Check if this vdev_id has SCC with
* other vdev_id's
* @psoc: PSOC object information
* @vdev_id: vdev_id
*
* This function checks if the given vdev_id has SCC with any other vdev's
* or not.
*
* Return: true if SCC exists, false otherwise
*/
bool policy_mgr_is_scc_with_this_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id);
/**
* policy_mgr_soc_set_dual_mac_cfg_cb() - Callback for set dual mac config
* @status: Status of set dual mac config

View file

@ -1573,6 +1573,42 @@ void policy_mgr_set_dual_mac_fw_mode_config(struct wlan_objmgr_psoc *psoc,
policy_mgr_err("sme_soc_set_dual_mac_config failed %d", status);
}
bool policy_mgr_is_scc_with_this_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
uint32_t i, ch_freq;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return false;
}
/* Get the channel freq for a given vdev_id */
status = policy_mgr_get_chan_by_session_id(psoc, vdev_id,
&ch_freq);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("Failed to get channel for vdev:%d", vdev_id);
return false;
}
/* Compare given vdev_id freq against other vdev_id's */
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
if ((pm_conc_connection_list[i].vdev_id != vdev_id) &&
(pm_conc_connection_list[i].in_use) &&
(pm_conc_connection_list[i].freq == ch_freq)) {
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
return true;
}
}
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
return false;
}
bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc)
{
uint32_t num_connections = 0;

View file

@ -1372,6 +1372,13 @@ int hdd_send_twt_add_dialog_cmd(struct hdd_context *hdd_ctx,
return ret;
}
static bool hdd_twt_setup_conc_allowed(struct hdd_context *hdd_ctx,
uint8_t vdev_id)
{
return policy_mgr_current_concurrency_is_mcc(hdd_ctx->psoc) ||
policy_mgr_is_scc_with_this_vdev_id(hdd_ctx->psoc, vdev_id);
}
/**
* hdd_twt_setup_session() - Process TWT setup operation in the
* received vendor command and send it to firmare
@ -1417,6 +1424,11 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter,
if (hdd_is_roaming_in_progress(hdd_ctx))
return -EBUSY;
if (hdd_twt_setup_conc_allowed(hdd_ctx, adapter->vdev_id)) {
hdd_err_rl("TWT setup reject: SCC or MCC concurrency exists");
return -EAGAIN;
}
qdf_mem_copy(params.peer_macaddr,
hdd_sta_ctx->conn_info.bssid.bytes,
QDF_MAC_ADDR_SIZE);