From 6d35309cc76eedfc3be09477313e5dae0f3c4c50 Mon Sep 17 00:00:00 2001 From: Subrat Dash Date: Sat, 28 Nov 2020 00:03:20 +0530 Subject: [PATCH] qcacmn: Capability to configure bcast TWT responder or requestor The bcast twt functionality may need to be enabled separately for requestor and responder roles. Enable such configuration by looking up WMI service bit support from target: wmi_service_twt_bcast_req_support wmi_service_twt_bcast_resp_support Change-Id: Ibc91173c23cf69f0d248af27d61c77bee3e8f48a CRs-Fixed: 2828720 --- wmi/inc/wmi_unified_param.h | 2 ++ wmi/inc/wmi_unified_twt_param.h | 33 ++++++++++++++++++++++++++++++++- wmi/src/wmi_unified_tlv.c | 7 ++++++- wmi/src/wmi_unified_twt_tlv.c | 14 ++++++++++++-- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index dd4607bba8..3674b16e74 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5319,6 +5319,8 @@ typedef enum { #endif wmi_service_scan_conf_per_ch_support, wmi_service_csa_beacon_template, + wmi_service_twt_bcast_req_support, + wmi_service_twt_bcast_resp_support, wmi_services_max, } wmi_conv_service_ids; #define WMI_SERVICE_UNAVAILABLE 0xFFFF diff --git a/wmi/inc/wmi_unified_twt_param.h b/wmi/inc/wmi_unified_twt_param.h index e946f1e2a5..98416a8606 100644 --- a/wmi/inc/wmi_unified_twt_param.h +++ b/wmi/inc/wmi_unified_twt_param.h @@ -23,6 +23,24 @@ #ifndef _WMI_UNIFIED_TWT_PARAM_H_ #define _WMI_UNIFIED_TWT_PARAM_H_ +/* enum WMI_TWT_ROLE - role specified in ext conf in wmi_twt_enable/disable_cmd + * WMI_TWT_ROLE_REQUESTOR: TWT role is requestor + * WMI_TWT_ROLE_RESPONDER: TWT role is responder + */ +enum WMI_TWT_ROLE { + WMI_TWT_ROLE_REQUESTOR, + WMI_TWT_ROLE_RESPONDER, +}; + +/* enum WMI_TWT_OPERATION - specified in ext conf in wmi_twt_enable/disable_cmd + * WMI_TWT_OPERATION_INDIVIDUAL: Individual TWT operation + * WMI_TWT_OPERATION_BROADCAST: Broadcast TWT operation + */ +enum WMI_TWT_OPERATION { + WMI_TWT_OPERATION_INDIVIDUAL, + WMI_TWT_OPERATION_BROADCAST, +}; + /** * @pdev_id: pdev_id for identifying the MAC. * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms @@ -62,6 +80,9 @@ * TWT slots for STAs. (units = milliseconds) * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT * slot of STAs. (units = milliseconds) + * @twt_role: values from enum WMI_TWT_ROLE. + * @twt_oper: values from enum WMI_TWT_OPERATION. + * @ext_conf_present: If requestor/responder extend config is present. * @b_twt_enable: Enable or disable broadcast TWT. * @b_twt_legacy_mbss_enable: Enable or disable legacy MBSSID TWT. * @b_twt_ax_mbss_enable: Enable or disable 11AX MBSSID TWT. @@ -84,6 +105,9 @@ struct wmi_twt_enable_param { uint32_t mode_check_interval; uint32_t add_sta_slot_interval; uint32_t remove_sta_slot_interval; + enum WMI_TWT_ROLE twt_role; + enum WMI_TWT_OPERATION twt_oper; + bool ext_conf_present; uint32_t b_twt_enable:1, b_twt_legacy_mbss_enable:1, b_twt_ax_mbss_enable:1; @@ -114,11 +138,18 @@ struct wmi_twt_enable_complete_event_param { uint32_t status; }; -/** struct wmi_twt_disable_param: +/** + *struct wmi_twt_disable_param: * @pdev_id: pdev_id for identifying the MAC. + * @ext_conf_present: If requestor/responder extend config is present. + * @twt_role: values from enum WMI_TWT_ROLE. + * @twt_oper: values from enum WMI_TWT_OPERATION. */ struct wmi_twt_disable_param { uint32_t pdev_id; + bool ext_conf_present; + enum WMI_TWT_ROLE twt_role; + enum WMI_TWT_OPERATION twt_oper; }; /** struct wmi_twt_disable_complete_event: diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index bfe15cfbd2..1f14cf478e 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15255,7 +15255,12 @@ static void populate_tlv_service(uint32_t *wmi_service) WMI_SERVICE_SCAN_CONFIG_PER_CHANNEL; wmi_service[wmi_service_csa_beacon_template] = WMI_SERVICE_CSA_BEACON_TEMPLATE; - +#ifdef WLAN_SUPPORT_TWT + wmi_service[wmi_service_twt_bcast_req_support] = + WMI_SERVICE_BROADCAST_TWT_REQUESTER; + wmi_service[wmi_service_twt_bcast_resp_support] = + WMI_SERVICE_BROADCAST_TWT_RESPONDER; +#endif wmi_populate_service_get_sta_in_ll_stats_req(wmi_service); } diff --git a/wmi/src/wmi_unified_twt_tlv.c b/wmi/src/wmi_unified_twt_tlv.c index 5ad01b9675..8beb9b9517 100644 --- a/wmi/src/wmi_unified_twt_tlv.c +++ b/wmi/src/wmi_unified_twt_tlv.c @@ -68,9 +68,14 @@ static QDF_STATUS send_twt_enable_cmd_tlv(wmi_unified_t wmi_handle, params->b_twt_legacy_mbss_enable); TWT_EN_DIS_FLAGS_SET_AX_MBSSID(cmd->flags, params->b_twt_ax_mbss_enable); + if (params->ext_conf_present) { + TWT_EN_DIS_FLAGS_SET_SPLIT_CONFIG(cmd->flags, 1); + TWT_EN_DIS_FLAGS_SET_REQ_RESP(cmd->flags, params->twt_role); + TWT_EN_DIS_FLAGS_SET_I_B_TWT(cmd->flags, params->twt_oper); + } status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), - WMI_TWT_ENABLE_CMDID); + WMI_TWT_ENABLE_CMDID); if (QDF_IS_STATUS_ERROR(status)) { wmi_err("Failed to send WMI_TWT_ENABLE_CMDID"); wmi_buf_free(buf); @@ -103,9 +108,14 @@ static QDF_STATUS send_twt_disable_cmd_tlv(wmi_unified_t wmi_handle, wmi_handle->ops->convert_pdev_id_host_to_target( wmi_handle, params->pdev_id); + if (params->ext_conf_present) { + TWT_EN_DIS_FLAGS_SET_SPLIT_CONFIG(cmd->flags, 1); + TWT_EN_DIS_FLAGS_SET_REQ_RESP(cmd->flags, params->twt_role); + TWT_EN_DIS_FLAGS_SET_I_B_TWT(cmd->flags, params->twt_oper); + } status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), - WMI_TWT_DISABLE_CMDID); + WMI_TWT_DISABLE_CMDID); if (QDF_IS_STATUS_ERROR(status)) { wmi_err("Failed to send WMI_TWT_DISABLE_CMDID"); wmi_buf_free(buf);