From 15db317ebb1d4c48fc0e87951b982eb5682d8673 Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Mon, 15 Mar 2021 11:42:49 -0700 Subject: [PATCH] qcacld-3.0: Allow TWT setup re-negotiation for the existing session Add support to allow TWT setup re-negotiation for the existing session. If the setup request is received: - before the host driver receiving the setup response event from firmware for the previous setup request, then return -EINPROGRESS. - after the host driver received the setup response event from firmware for the previous setup request, then setup_done is set to true and this new setup request is sent to firmware for parameter re-negotiation. CRs-Fixed: 2897896 Change-Id: I4d0cc5dac8d569a2e57c70ae6896ad1a24937597 --- components/mlme/core/src/wlan_mlme_twt_api.c | 4 +++- core/hdd/src/wlan_hdd_twt.c | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_twt_api.c b/components/mlme/core/src/wlan_mlme_twt_api.c index 2a6f04a2ff49..c15ce617a987 100644 --- a/components/mlme/core/src/wlan_mlme_twt_api.c +++ b/components/mlme/core/src/wlan_mlme_twt_api.c @@ -51,10 +51,12 @@ bool mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc, } for (i = 0; i < peer_priv->twt_ctx.num_twt_sessions; i++) { + bool setup_done = peer_priv->twt_ctx.session_info[i].setup_done; existing_session_dialog_id = peer_priv->twt_ctx.session_info[i].dialog_id; if (existing_session_dialog_id == dialog_id && - existing_session_dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID) { + existing_session_dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID && + !setup_done) { wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID); return true; } diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c index b23e69fbeb82..820f2902ac2a 100644 --- a/core/hdd/src/wlan_hdd_twt.c +++ b/core/hdd/src/wlan_hdd_twt.c @@ -1337,6 +1337,15 @@ int hdd_send_twt_add_dialog_cmd(struct hdd_context *hdd_ctx, * Handles QCA_WLAN_TWT_SET * * Return: 0 for Success and negative value for failure + * + * If the setup request is received: + * before the host driver receiving the setup response event from + * firmware for the previous setup request, then return -EINPROGRESS + * + * after the host driver received the setup response event from + * firmware for the previous setup request, then setup_done is + * set to true and this new setup request is sent to firmware + * for parameter re-negotiation. */ static int hdd_twt_setup_session(struct hdd_adapter *adapter, struct nlattr *twt_param_attr) @@ -1396,13 +1405,10 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter, if (ucfg_mlme_is_twt_setup_in_progress(adapter->hdd_ctx->psoc, &hdd_sta_ctx->conn_info.bssid, - params.dialog_id) || - ucfg_mlme_is_twt_setup_done(adapter->hdd_ctx->psoc, - &hdd_sta_ctx->conn_info.bssid, params.dialog_id)) { - hdd_err_rl("TWT session exists for dialog:%d", + hdd_err_rl("TWT setup is in progress for dialog_id:%d", params.dialog_id); - return -EALREADY; + return -EINPROGRESS; } ret = hdd_send_twt_add_dialog_cmd(adapter->hdd_ctx, ¶ms);