From dc1ddf5e3bfe62d982388f9250b7488174ff80b2 Mon Sep 17 00:00:00 2001 From: Jyoti Kumari Date: Thu, 24 Jun 2021 00:54:06 +0530 Subject: [PATCH] qcacld-3.0: Add TWT service bit capability support for ack event Add TWT service bit capability support to check whether firmware supports ack event or not. If firmware doesn't support ack event then service bit capability will become 0 and whenever the TWT command comes, host will not wait for ack event and sends command in a legacy way This support is mainly added to handle new host and old firmware combination. Change-Id: I556d8edf0b505b774d756d6d904dd445418837bf CRs-Fixed: 2987966 --- core/hdd/src/wlan_hdd_twt.c | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c index 04adaa42d533..2b050eb2f24f 100644 --- a/core/hdd/src/wlan_hdd_twt.c +++ b/core/hdd/src/wlan_hdd_twt.c @@ -37,6 +37,7 @@ #include "cfg_ucfg_api.h" #include #include +#include #define TWT_DISABLE_COMPLETE_TIMEOUT 1000 #define TWT_ENABLE_COMPLETE_TIMEOUT 1000 @@ -1560,8 +1561,10 @@ static int hdd_send_twt_add_dialog_cmd(struct hdd_context *hdd_ctx, struct wmi_twt_add_dialog_param *twt_params) { + struct target_psoc_info *tgt_hdl; QDF_STATUS status; int ret; + bool twt_ack_cap; status = sme_add_dialog_cmd(hdd_ctx->mac_handle, hdd_twt_add_dialog_comp_cb, @@ -1569,6 +1572,14 @@ int hdd_send_twt_add_dialog_cmd(struct hdd_context *hdd_ctx, if (!QDF_IS_STATUS_SUCCESS(status)) hdd_err("Failed to send add dialog command"); + tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->psoc); + if (!tgt_hdl) { + hdd_err("tgt_hdl is NULL"); + return -EINVAL; + } + + target_psoc_get_twt_ack_cap(tgt_hdl, &twt_ack_cap); + ret = qdf_status_to_os_return(status); return ret; @@ -1881,17 +1892,28 @@ static int hdd_send_twt_del_dialog_cmd(struct hdd_context *hdd_ctx, struct wmi_twt_del_dialog_param *twt_params) { + struct target_psoc_info *tgt_hdl; QDF_STATUS status; int ret = 0; + bool twt_ack_cap; status = sme_del_dialog_cmd(hdd_ctx->mac_handle, hdd_twt_del_dialog_comp_cb, twt_params); + if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Failed to send del dialog command"); ret = qdf_status_to_os_return(status); } + tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->psoc); + if (!tgt_hdl) { + hdd_err("tgt_hdl is NULL"); + return -EINVAL; + } + + target_psoc_get_twt_ack_cap(tgt_hdl, &twt_ack_cap); + return ret; } @@ -2353,8 +2375,10 @@ static int hdd_send_twt_pause_dialog_cmd(struct hdd_context *hdd_ctx, struct wmi_twt_pause_dialog_cmd_param *twt_params) { + struct target_psoc_info *tgt_hdl; QDF_STATUS status; int ret = 0; + bool twt_ack_cap; status = sme_pause_dialog_cmd(hdd_ctx->mac_handle, twt_params); @@ -2363,6 +2387,14 @@ int hdd_send_twt_pause_dialog_cmd(struct hdd_context *hdd_ctx, ret = qdf_status_to_os_return(status); } + tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->psoc); + if (!tgt_hdl) { + hdd_err("tgt_hdl is NULL"); + return -EINVAL; + } + + target_psoc_get_twt_ack_cap(tgt_hdl, &twt_ack_cap); + return ret; } @@ -2447,12 +2479,22 @@ static int hdd_send_twt_nudge_dialog_cmd(struct hdd_context *hdd_ctx, struct wmi_twt_nudge_dialog_cmd_param *twt_params) { + struct target_psoc_info *tgt_hdl; QDF_STATUS status; + bool twt_ack_cap; status = sme_nudge_dialog_cmd(hdd_ctx->mac_handle, twt_params); if (QDF_IS_STATUS_ERROR(status)) hdd_err("Failed to send nudge dialog command"); + tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->psoc); + if (!tgt_hdl) { + hdd_err("tgt_hdl is NULL"); + return -EINVAL; + } + + target_psoc_get_twt_ack_cap(tgt_hdl, &twt_ack_cap); + return qdf_status_to_os_return(status); } @@ -2680,8 +2722,10 @@ static int hdd_send_twt_resume_dialog_cmd(struct hdd_context *hdd_ctx, struct wmi_twt_resume_dialog_cmd_param *twt_params) { + struct target_psoc_info *tgt_hdl; QDF_STATUS status; int ret = 0; + bool twt_ack_cap; status = sme_resume_dialog_cmd(hdd_ctx->mac_handle, twt_params); @@ -2690,6 +2734,14 @@ hdd_send_twt_resume_dialog_cmd(struct hdd_context *hdd_ctx, ret = qdf_status_to_os_return(status); } + tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->psoc); + if (!tgt_hdl) { + hdd_err("tgt_hdl is NULL"); + return -EINVAL; + } + + target_psoc_get_twt_ack_cap(tgt_hdl, &twt_ack_cap); + return ret; }