From 0fa8f27ce61718d5dd85b05c9eee69793111a2ee Mon Sep 17 00:00:00 2001 From: "eric.luo" Date: Tue, 30 Sep 2025 22:55:53 +0800 Subject: [PATCH] qcacld-3.0: Enable active mode APF on screen off Change-Id: Ibe01a5127cd35e96def28202b30b12d74b237b88 --- .../qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c | 37 ++++- .../core/mac/src/include/sir_params.h | 6 +- .../src/sys/legacy/src/utils/src/mac_trace.c | 6 +- .../wlan/qcacld-3.0/core/sme/inc/sme_api.h | 48 ++++++- .../qcacld-3.0/core/sme/src/common/sme_api.c | 110 +++++++++++++++ .../wlan/qcacld-3.0/core/wma/inc/wma_api.h | 42 +++++- .../wlan/qcacld-3.0/core/wma/inc/wma_types.h | 6 +- .../wlan/qcacld-3.0/core/wma/src/wma_dev_if.c | 60 +------- .../qcacld-3.0/core/wma/src/wma_features.c | 133 +++++++++++++++++- .../wlan/qcacld-3.0/core/wma/src/wma_main.c | 17 ++- 10 files changed, 394 insertions(+), 71 deletions(-) diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c index 8b25d03373eb..30e17289365b 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -3193,6 +3193,36 @@ exit: return ret; } +#ifdef FEATURE_WLAN_APF +static void hdd_enable_active_apf_mode(struct wlan_hdd_link_info *link_info) +{ + struct hdd_adapter *adapter = link_info->adapter; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + sme_enable_active_apf_mode_ind(hdd_ctx->mac_handle, adapter->device_mode, + adapter->mac_addr.bytes, link_info->vdev_id); +} + +static void hdd_disable_active_apf_mode(struct wlan_hdd_link_info *link_info) +{ + struct hdd_adapter *adapter = link_info->adapter; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + sme_disable_active_apf_mode_ind(hdd_ctx->mac_handle, adapter->device_mode, + adapter->mac_addr.bytes, link_info->vdev_id); +} +#else +static void +hdd_enable_active_apf_mode(struct wlan_hdd_link_info *link_info) +{ +} + +static void +hdd_disable_active_apf_mode(struct wlan_hdd_link_info *link_info) +{ +} +#endif + static int drv_cmd_set_suspend_mode(struct wlan_hdd_link_info *link_info, struct hdd_context *hdd_ctx, uint8_t *command, @@ -3225,6 +3255,11 @@ static int drv_cmd_set_suspend_mode(struct wlan_hdd_link_info *link_info, } hdd_debug("idle_monitor:%d", idle_monitor); + if (idle_monitor == 0) + hdd_disable_active_apf_mode(link_info); + else if (idle_monitor == 1) + hdd_enable_active_apf_mode(link_info); + status = ucfg_pmo_tgt_psoc_send_idle_roam_suspend_mode(hdd_ctx->psoc, idle_monitor); if (QDF_IS_STATUS_ERROR(status)) { diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/include/sir_params.h b/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/include/sir_params.h index edc63845f558..471c7b90e200 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/include/sir_params.h +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/include/sir_params.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -658,6 +658,10 @@ enum halmsgtype { SIR_HAL_TWT_NUDGE_DIALOG_REQUEST = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 422), SIR_HAL_PASN_PEER_DELETE_REQUEST = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 423), SIR_HAL_UPDATE_EDCA_PIFS_PARAM_IND = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 424), +#ifdef FEATURE_WLAN_APF + SIR_HAL_ENABLE_ACTIVE_APF_MODE_IND = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 425), + SIR_HAL_DISABLE_ACTIVE_APF_MODE_IND = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 426), +#endif SIR_HAL_MSG_TYPES_END = (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF), }; diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index a6b412da8875..171cb95e01d9 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -551,6 +551,10 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_SET_THERMAL_MGMT); #endif /* FW_THERMAL_THROTTLE_SUPPORT */ CASE_RETURN_STRING(WMA_UPDATE_EDCA_PIFS_PARAM_IND); +#ifdef FEATURE_WLAN_APF + CASE_RETURN_STRING(WMA_ENABLE_ACTIVE_APF_MODE_IND); + CASE_RETURN_STRING(WMA_DISABLE_ACTIVE_APF_MODE_IND); +#endif default: return (uint8_t *) "UNKNOWN"; break; diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/inc/sme_api.h b/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/inc/sme_api.h index 0fcb67b499c5..4700b646c554 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/inc/sme_api.h +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/inc/sme_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -761,6 +761,52 @@ QDF_STATUS sme_neighbor_report_request(mac_handle_t mac_handle, tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo); +#ifdef FEATURE_WLAN_APF + +/* + * sme_enable_active_apf_mode_ind() - + * API to signal the FW about active APF enablement. + * + * mac_handle: Opaque handle to the global MAC context. + * device_mode - mode(AP,SAP etc) of the device. + * macAddr - MAC address of the adapter. + * sessionId - session ID. + * Return QDF_STATUS SUCCESS. + * FAILURE or RESOURCES The API finished and failed. + */ + +QDF_STATUS sme_enable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId); + +/* + * sme_disable_active_apf_mode_ind() - + * API to signal the FW about active APF disablement. + * + * mac_handle: Opaque handle to the global MAC context. + * device_mode - mode(AP,SAP etc) of the device. + * macAddr - MAC address of the adapter. + * sessionId - session ID. + * Return QDF_STATUS SUCCESS. + * FAILURE or RESOURCES The API finished and failed. + */ +QDF_STATUS sme_disable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId); +#else +QDF_STATUS sme_enable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId) +{ +} + +QDF_STATUS sme_disable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId) +{ +} +#endif + /** * sme_register_pagefault_cb() - Register cb to handle host action on pagefault * @mac_handle: Opaque handle to the global MAC context. diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/src/common/sme_api.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/src/common/sme_api.c index 943d8a8a8873..6e1a104f609d 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/src/common/sme_api.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/sme/src/common/sme_api.c @@ -3906,6 +3906,116 @@ QDF_STATUS sme_generic_change_country_code(mac_handle_t mac_handle, return status; } +#ifdef FEATURE_WLAN_APF +QDF_STATUS sme_enable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId) +{ + QDF_STATUS status; + QDF_STATUS qdf_status; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + struct scheduler_msg message = {0}; + tAniDHCPInd *pMsg; + struct csr_roam_session *pSession; + + status = sme_acquire_global_lock(&mac->sme); + if (status == QDF_STATUS_SUCCESS) { + pSession = CSR_GET_SESSION(mac, sessionId); + + if (!pSession) { + sme_err("Session: %d not found", sessionId); + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_FAILURE; + } + pSession->dhcp_done = false; + + pMsg = qdf_mem_malloc(sizeof(tAniDHCPInd)); + if (!pMsg) { + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_NOMEM; + } + pMsg->msgType = WMA_ENABLE_ACTIVE_APF_MODE_IND; + pMsg->msgLen = (uint16_t)sizeof(tAniDHCPInd); + pMsg->device_mode = device_mode; + qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, + QDF_MAC_ADDR_SIZE); + wlan_mlme_get_bssid_vdev_id(mac->pdev, sessionId, + &pMsg->peerMacAddr); + + message.type = WMA_ENABLE_ACTIVE_APF_MODE_IND; + message.bodyptr = pMsg; + message.reserved = 0; + MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, + sessionId, message.type)); + qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, + QDF_MODULE_ID_WMA, + QDF_MODULE_ID_WMA, + &message); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + sme_err("Post enable APF mode MSG fail"); + qdf_mem_free(pMsg); + status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac->sme); + } + return status; +} + +QDF_STATUS sme_disable_active_apf_mode_ind(mac_handle_t mac_handle, + uint8_t device_mode, + uint8_t *macAddr, uint8_t sessionId) +{ + QDF_STATUS status; + QDF_STATUS qdf_status; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + struct scheduler_msg message = {0}; + tAniDHCPInd *pMsg; + struct csr_roam_session *pSession; + + status = sme_acquire_global_lock(&mac->sme); + if (status == QDF_STATUS_SUCCESS) { + pSession = CSR_GET_SESSION(mac, sessionId); + + if (!pSession) { + sme_err("Session: %d not found", sessionId); + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_FAILURE; + } + pSession->dhcp_done = false; + + pMsg = qdf_mem_malloc(sizeof(tAniDHCPInd)); + if (!pMsg) { + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_NOMEM; + } + pMsg->msgType = WMA_DISABLE_ACTIVE_APF_MODE_IND; + pMsg->msgLen = (uint16_t)sizeof(tAniDHCPInd); + pMsg->device_mode = device_mode; + qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, + QDF_MAC_ADDR_SIZE); + wlan_mlme_get_bssid_vdev_id(mac->pdev, sessionId, + &pMsg->peerMacAddr); + + message.type = WMA_DISABLE_ACTIVE_APF_MODE_IND; + message.bodyptr = pMsg; + message.reserved = 0; + MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, + sessionId, message.type)); + qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, + QDF_MODULE_ID_WMA, + QDF_MODULE_ID_WMA, + &message); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + sme_err("Post disable APF mode MSG fail"); + qdf_mem_free(pMsg); + status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac->sme); + } + return status; +} +#endif + /* * sme_dhcp_start_ind() - * API to signal the FW about the DHCP Start event. diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_api.h b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_api.h index df1b26ef76b0..72f933da9150 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_api.h +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -103,9 +103,9 @@ struct wma_ps_params { /** * enum wma_sta_ps_scheme_cfg - STA power save schemes - * @WMA_STA_PS_OPM_CONSERVATIVE - Conservative OPM mode - * @WMA_STA_PS_OPM_AGGRESSIVE - Aggressive OPM mode - * @WMA_STA_PS_USER_DEF - User defined OPM mode + * @WMA_STA_PS_OPM_CONSERVATIVE: Conservative OPM mode + * @WMA_STA_PS_OPM_AGGRESSIVE: Aggressive OPM mode + * @WMA_STA_PS_USER_DEF: User defined OPM mode */ enum wma_sta_ps_scheme_cfg { WMA_STA_PS_OPM_CONSERVATIVE = 0, @@ -541,6 +541,40 @@ QDF_STATUS wma_set_vc_mode_config(void *wma_handle, QDF_STATUS wma_process_dhcp_ind(WMA_HANDLE wma_handle, tAniDHCPInd *ta_dhcp_ind); +#ifdef FEATURE_WLAN_APF +/** + * wma_enable_active_apf_mode() - Enable apf mode. + * @handle: pointer to wma handle. + * @ta_dhcp_ind: dhcp indicator. + * + * Enable apf mode. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wma_enable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind); + +/** + * wma_disable_active_apf_mode() - Disable apf mode. + * @handle: pointer to wma handle. + * @ta_dhcp_ind: dhcp indicator. + * + * Disable apf mode. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wma_disable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind); +#else +QDF_STATUS wma_enable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wma_disable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind) +{ + return QDF_STATUS_SUCCESS; +} +#endif + /** * wma_wmi_stop() - send wmi stop cmd * diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_types.h b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_types.h index c22c29ce2f66..d90c70f3d921 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_types.h +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/inc/wma_types.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -440,6 +440,10 @@ enum wmamsgtype { WMA_TWT_NUDGE_DIALOG_REQUEST = SIR_HAL_TWT_NUDGE_DIALOG_REQUEST, WMA_PASN_PEER_DELETE_REQUEST = SIR_HAL_PASN_PEER_DELETE_REQUEST, WMA_UPDATE_EDCA_PIFS_PARAM_IND = SIR_HAL_UPDATE_EDCA_PIFS_PARAM_IND, +#ifdef FEATURE_WLAN_APF + WMA_ENABLE_ACTIVE_APF_MODE_IND = SIR_HAL_ENABLE_ACTIVE_APF_MODE_IND, + WMA_DISABLE_ACTIVE_APF_MODE_IND = SIR_HAL_DISABLE_ACTIVE_APF_MODE_IND, +#endif }; /* Bit 6 will be used to control BD rate for Management frames */ diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_dev_if.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_dev_if.c index 7c364897b376..1f526ac65edd 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_dev_if.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_dev_if.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2463,56 +2463,6 @@ static int wma_remove_bss_peer(tp_wma_handle wma, uint32_t vdev_id, return ret_value; } -#ifdef FEATURE_WLAN_APF -/* - * get_fw_active_apf_mode() - convert HDD APF mode to FW configurable APF - * mode - * @mode: APF mode maintained in HDD - * - * Return: FW configurable BP mode - */ -static enum wmi_host_active_apf_mode -get_fw_active_apf_mode(enum active_apf_mode mode) -{ - switch (mode) { - case ACTIVE_APF_DISABLED: - return WMI_HOST_ACTIVE_APF_DISABLED; - case ACTIVE_APF_ENABLED: - return WMI_HOST_ACTIVE_APF_ENABLED; - case ACTIVE_APF_ADAPTIVE: - return WMI_HOST_ACTIVE_APF_ADAPTIVE; - default: - wma_err("Invalid Active APF Mode %d; Using 'disabled'", mode); - return WMI_HOST_ACTIVE_APF_DISABLED; - } -} - -/** - * wma_config_active_apf_mode() - Config active APF mode in FW - * @wma: the WMA handle - * @vdev_id: the Id of the vdev for which the configuration should be applied - * - * Return: QDF status - */ -static QDF_STATUS wma_config_active_apf_mode(t_wma_handle *wma, uint8_t vdev_id) -{ - enum wmi_host_active_apf_mode uc_mode, mcbc_mode; - - uc_mode = get_fw_active_apf_mode(wma->active_uc_apf_mode); - mcbc_mode = get_fw_active_apf_mode(wma->active_mc_bc_apf_mode); - - wma_debug("Configuring Active APF Mode UC:%d MC/BC:%d for vdev %u", - uc_mode, mcbc_mode, vdev_id); - - return wmi_unified_set_active_apf_mode_cmd(wma->wmi_handle, vdev_id, - uc_mode, mcbc_mode); -} -#else /* FEATURE_WLAN_APF */ -static QDF_STATUS wma_config_active_apf_mode(t_wma_handle *wma, uint8_t vdev_id) -{ - return QDF_STATUS_SUCCESS; -} -#endif /* FEATURE_WLAN_APF */ #ifdef FEATURE_AP_MCC_CH_AVOIDANCE /** @@ -3222,14 +3172,6 @@ QDF_STATUS wma_post_vdev_create_setup(struct wlan_objmgr_vdev *vdev) wma_err("Failed to get value for WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED, leaving unchanged"); } - if (vdev_mlme->mgmt.generic.type == WMI_VDEV_TYPE_STA && - ucfg_pmo_is_apf_enabled(wma_handle->psoc)) { - ret = wma_config_active_apf_mode(wma_handle, - vdev_id); - if (QDF_IS_STATUS_ERROR(ret)) - wma_err("Failed to configure active APF mode"); - } - if (vdev_mlme->mgmt.generic.type == WMI_VDEV_TYPE_STA && vdev_mlme->mgmt.generic.subtype == 0) wma_set_vdev_latency_level_param(wma_handle, mac, vdev_id); diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_features.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_features.c index ac7c4d89808e..b7e0ecee925e 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_features.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_features.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -605,6 +605,137 @@ QDF_STATUS wma_set_wisa_params(tp_wma_handle wma_handle, return status; } +#ifdef FEATURE_WLAN_APF +/* + * get_fw_active_apf_mode() - convert HDD APF mode to FW configurable APF + * mode + * @mode: APF mode maintained in HDD + * + * Return: FW configurable BP mode + */ +static enum wmi_host_active_apf_mode +get_fw_active_apf_mode(enum active_apf_mode mode) +{ + switch (mode) { + case ACTIVE_APF_DISABLED: + return WMI_HOST_ACTIVE_APF_DISABLED; + case ACTIVE_APF_ENABLED: + return WMI_HOST_ACTIVE_APF_ENABLED; + case ACTIVE_APF_ADAPTIVE: + return WMI_HOST_ACTIVE_APF_ADAPTIVE; + default: + wma_err("Invalid Active APF Mode %d; Using 'disabled'", mode); + return WMI_HOST_ACTIVE_APF_DISABLED; + } +} + +QDF_STATUS wma_enable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind) +{ + tp_wma_handle wma_handle = (tp_wma_handle) handle; + enum wmi_host_active_apf_mode uc_mode, mcbc_mode; + struct vdev_mlme_obj *vdev_mlme; + struct wlan_objmgr_vdev *vdev; + uint8_t vdev_id; + QDF_STATUS ret = QDF_STATUS_SUCCESS; + + if (!ta_dhcp_ind) { + wma_err("DHCP indication is NULL"); + return QDF_STATUS_E_FAILURE; + } + wma_debug("Enabling active apf mode"); + + if (wma_find_vdev_id_by_addr(wma_handle, + ta_dhcp_ind->adapterMacAddr.bytes, + &vdev_id)) { + wma_err("Failed to find vdev id for DHCP indication"); + return QDF_STATUS_E_FAILURE; + } + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc, + vdev_id, + WLAN_LEGACY_WMA_ID); + if (!vdev) + return -EINVAL; + + vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); + if (!vdev_mlme) { + wma_err("Failed to get vdev mlme obj!"); + ret = -EINVAL; + goto release_ref_and_return; + } + if (vdev_mlme->mgmt.generic.type == WMI_VDEV_TYPE_STA && + ucfg_pmo_is_apf_enabled(wma_handle->psoc)) { + uc_mode = get_fw_active_apf_mode(wma_handle->active_uc_apf_mode); + mcbc_mode = get_fw_active_apf_mode(wma_handle->active_mc_bc_apf_mode); + wma_debug("Configuring Active APF Mode UC:%d MC/BC:%d for vdev %u", + uc_mode, mcbc_mode, vdev_id); + + ret = wmi_unified_set_active_apf_mode_cmd(wma_handle->wmi_handle, vdev_id, + uc_mode, mcbc_mode); + + if (QDF_IS_STATUS_ERROR(ret)) + wma_err("Failed to configure active APF mode"); + } +release_ref_and_return: + wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID); + return ret; +} + +QDF_STATUS wma_disable_active_apf_mode(WMA_HANDLE handle, tAniDHCPInd *ta_dhcp_ind) +{ + tp_wma_handle wma_handle = (tp_wma_handle)handle; + enum wmi_host_active_apf_mode uc_mode, mcbc_mode; + struct vdev_mlme_obj *vdev_mlme; + struct wlan_objmgr_vdev *vdev; + uint8_t vdev_id; + QDF_STATUS ret = QDF_STATUS_SUCCESS; + + if (!ta_dhcp_ind) { + wma_err("DHCP indication is NULL"); + return QDF_STATUS_E_FAILURE; + } + + wma_debug("Disabling active apf mode"); + + if (wma_find_vdev_id_by_addr(wma_handle, + ta_dhcp_ind->adapterMacAddr.bytes, + &vdev_id)) { + wma_err("Failed to find vdev id for DHCP indication"); + return QDF_STATUS_E_FAILURE; + } + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc, + vdev_id, + WLAN_LEGACY_WMA_ID); + if (!vdev) + return -EINVAL; + + vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); + if (!vdev_mlme) { + wma_err("Failed to get vdev mlme obj!"); + ret = -EINVAL; + goto release_ref_and_return; + } + if (vdev_mlme->mgmt.generic.type == WMI_VDEV_TYPE_STA && + ucfg_pmo_is_apf_enabled(wma_handle->psoc)) { + uc_mode = WMI_HOST_ACTIVE_APF_DISABLED; + mcbc_mode = WMI_HOST_ACTIVE_APF_DISABLED; + + wma_debug("Configuring Active APF Mode UC:%d MC/BC:%d for vdev %u", + uc_mode, mcbc_mode, vdev_id); + + ret = wmi_unified_set_active_apf_mode_cmd(wma_handle->wmi_handle, vdev_id, + uc_mode, mcbc_mode); + + if (QDF_IS_STATUS_ERROR(ret)) + wma_err("Failed to configure active APF mode"); + } +release_ref_and_return: + wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID); + return ret; +} +#endif /* FEATURE_WLAN_APF */ + /** * wma_process_dhcp_ind() - process dhcp indication from SME * @wma_handle: wma handle diff --git a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_main.c b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_main.c index da32301b79e8..834115a5b90c 100644 --- a/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_main.c +++ b/vendor/qcom/opensource/wlan/qcacld-3.0/core/wma/src/wma_main.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -9455,8 +9455,11 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) break; #endif /* FEATURE_WLAN_AUTO_SHUTDOWN */ case WMA_DHCP_START_IND: + wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *)msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; case WMA_DHCP_STOP_IND: - wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *) msg->bodyptr); + wma_process_dhcp_ind(wma_handle, (tAniDHCPInd *)msg->bodyptr); qdf_mem_free(msg->bodyptr); break; case WMA_INIT_THERMAL_INFO_CMD: @@ -9885,6 +9888,16 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) (struct edca_pifs_vparam *)msg->bodyptr); qdf_mem_free(msg->bodyptr); break; +#ifdef FEATURE_WLAN_APF + case WMA_ENABLE_ACTIVE_APF_MODE_IND: + wma_enable_active_apf_mode(wma_handle, (tAniDHCPInd *)msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; + case WMA_DISABLE_ACTIVE_APF_MODE_IND: + wma_disable_active_apf_mode(wma_handle, (tAniDHCPInd *)msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; +#endif default: wma_debug("Unhandled WMA message of type %d", msg->type); if (msg->bodyptr)