diff --git a/target_if/green_ap/inc/target_if_green_ap.h b/target_if/green_ap/inc/target_if_green_ap.h index 46666069fd..9fa04e57f6 100644 --- a/target_if/green_ap/inc/target_if_green_ap.h +++ b/target_if/green_ap/inc/target_if_green_ap.h @@ -37,6 +37,16 @@ QDF_STATUS target_if_register_green_ap_tx_ops( struct wlan_lmac_if_tx_ops *tx_ops); +/** + * target_if_green_ap_register_egap_event_handler() - registers enhanced + * green ap event handler + * @pdev: objmgr pdev + * + * Return: QDF_STATUS in case of success + */ +QDF_STATUS target_if_green_ap_register_egap_event_handler( + struct wlan_objmgr_pdev *pdev); + /** * target_if_green_ap_enable_egap() - enable enhanced green ap * @pdev: pdev pointer diff --git a/target_if/green_ap/src/target_if_green_ap.c b/target_if/green_ap/src/target_if_green_ap.c index 185bca79e2..9477ec4712 100644 --- a/target_if/green_ap/src/target_if_green_ap.c +++ b/target_if/green_ap/src/target_if_green_ap.c @@ -48,6 +48,79 @@ QDF_STATUS target_if_register_green_ap_tx_ops( return QDF_STATUS_SUCCESS; } +/** + * target_if_green_ap_egap_status_info_event() - egap status info event + * @scn: pointer to scn handle + * @evt_buf: pointer to event buffer + * @data_len: data len of the event buffer + * + * Return: 0 for success, otherwise appropriate error code + */ +static int target_if_green_ap_egap_status_info_event( + ol_scn_t scn, uint8_t *evt_buf, uint32_t data_len) +{ + struct wlan_objmgr_pdev *pdev; + struct wlan_green_ap_egap_status_info egap_status_info_params; + + pdev = target_if_get_pdev_from_scn_hdl(scn); + if (!pdev) { + green_ap_err("pdev is null"); + return QDF_STATUS_E_FAILURE; + } + + if (wmi_extract_green_ap_egap_status_info(GET_WMI_HDL_FROM_PDEV(pdev), + evt_buf, + &egap_status_info_params) != + QDF_STATUS_SUCCESS) { + green_ap_err("unable to extract green ap egap status info"); + return QDF_STATUS_E_FAILURE; + } + + green_ap_debug("mac_id: %d, status: %d, tx_mask: %x, rx_mask: %d", + egap_status_info_params.mac_id, + egap_status_info_params.status, + egap_status_info_params.tx_chainmask, + egap_status_info_params.rx_chainmask); + + return 0; +} + +QDF_STATUS target_if_green_ap_register_egap_event_handler( + struct wlan_objmgr_pdev *pdev) +{ + struct wlan_pdev_green_ap_ctx *green_ap_ctx; + struct wlan_green_ap_egap_params *egap_params; + int ret; + + if (!pdev || !GET_WMI_HDL_FROM_PDEV(pdev)) { + green_ap_err("pdev or pdev->tgt_if_handle is null"); + return QDF_STATUS_E_INVAL; + } + + green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj( + pdev, WLAN_UMAC_COMP_GREEN_AP); + if (!green_ap_ctx) { + green_ap_err("green ap context obtained is NULL"); + return QDF_STATUS_E_FAILURE; + } + egap_params = &green_ap_ctx->egap_params; + + ret = wmi_unified_register_event_handler( + GET_WMI_HDL_FROM_PDEV(pdev), + wmi_ap_ps_egap_info_event_id, + target_if_green_ap_egap_status_info_event, + WMI_RX_UMAC_CTX); + if (ret < 0) { + green_ap_err("Failed to register Enhance Green AP event"); + egap_params->fw_egap_support = false; + } else { + green_ap_info("Set the Enhance Green AP event handler"); + egap_params->fw_egap_support = true; + } + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS target_if_green_ap_enable_egap( struct wlan_objmgr_pdev *pdev, struct wlan_green_ap_egap_params *egap_params) diff --git a/umac/green_ap/core/src/wlan_green_ap_main.c b/umac/green_ap/core/src/wlan_green_ap_main.c index c0cabd278e..84b298252f 100644 --- a/umac/green_ap/core/src/wlan_green_ap_main.c +++ b/umac/green_ap/core/src/wlan_green_ap_main.c @@ -199,16 +199,16 @@ QDF_STATUS wlan_green_ap_state_mc(struct wlan_pdev_green_ap_ctx *green_ap_ctx, /* Confirm that power save is enabled before doing state transitions */ if (!green_ap_ctx->ps_enable) { green_ap_debug("Green-AP is disabled"); - wlan_green_ap_ps_event_state_update( - green_ap_ctx, - WLAN_GREEN_AP_PS_IDLE_STATE, - WLAN_GREEN_AP_PS_WAIT_EVENT); if (green_ap_ctx->ps_state == WLAN_GREEN_AP_PS_ON_STATE) { if (green_ap_tx_ops->ps_on_off_send(green_ap_ctx->pdev, false, pdev_id)) green_ap_err("failed to set green ap mode"); wlan_green_ap_ant_ps_reset(green_ap_ctx); } + wlan_green_ap_ps_event_state_update( + green_ap_ctx, + WLAN_GREEN_AP_PS_IDLE_STATE, + WLAN_GREEN_AP_PS_WAIT_EVENT); goto done; } diff --git a/umac/green_ap/dispatcher/inc/wlan_green_ap_api.h b/umac/green_ap/dispatcher/inc/wlan_green_ap_api.h index c94001c1ee..8e819ae81e 100644 --- a/umac/green_ap/dispatcher/inc/wlan_green_ap_api.h +++ b/umac/green_ap/dispatcher/inc/wlan_green_ap_api.h @@ -43,6 +43,20 @@ struct wlan_green_ap_egap_params { uint32_t egap_feature_flags; }; +/** + * struct wlan_green_ap_egap_status_info - enhance green ap params + * @status: egap status + * @mac_id: mac id + * @tx_chainmask: tx chainmask + * @rx_chainmask: rx chainmask + */ +struct wlan_green_ap_egap_status_info { + uint32_t status; + uint32_t mac_id; + uint32_t tx_chainmask; + uint32_t rx_chainmask; +}; + /** * wlan_green_ap_init() - initialize green ap component * diff --git a/umac/green_ap/dispatcher/inc/wlan_green_ap_ucfg_api.h b/umac/green_ap/dispatcher/inc/wlan_green_ap_ucfg_api.h index 8d8dde15c1..3d0a54ca5c 100644 --- a/umac/green_ap/dispatcher/inc/wlan_green_ap_ucfg_api.h +++ b/umac/green_ap/dispatcher/inc/wlan_green_ap_ucfg_api.h @@ -61,19 +61,6 @@ QDF_STATUS ucfg_green_ap_update_user_config( */ QDF_STATUS ucfg_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev); -/** - * ucfg_green_ap_target_config() - Handle Green AP target configuration - * @pdev: pdev pointer - * @fw_egap_support: fw egap support - * - * This API stores the fw enhanced green AP support capability - * in green ap ctx. - * - * Return: Success or Failure - */ -QDF_STATUS ucfg_green_ap_target_config(struct wlan_objmgr_pdev *pdev, - bool fw_egap_support); - /** * ucfg_green_ap_set_ps_config() - Set ps value * @pdev: pdev pointer diff --git a/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c b/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c index 423b663b25..153b5bafcf 100644 --- a/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c +++ b/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c @@ -86,30 +86,6 @@ QDF_STATUS ucfg_green_ap_enable_egap(struct wlan_objmgr_pdev *pdev) return green_ap_tx_ops->enable_egap(pdev, &green_ap_ctx->egap_params); } -QDF_STATUS ucfg_green_ap_target_config(struct wlan_objmgr_pdev *pdev, - bool fw_egap_support) -{ - struct wlan_pdev_green_ap_ctx *green_ap_ctx; - - if (!pdev) { - green_ap_err("pdev context passed is NULL"); - return QDF_STATUS_E_INVAL; - } - - green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj( - pdev, WLAN_UMAC_COMP_GREEN_AP); - if (!green_ap_ctx) { - green_ap_err("green ap context obtained is NULL"); - return QDF_STATUS_E_FAILURE; - } - - qdf_spin_lock_bh(&green_ap_ctx->lock); - green_ap_ctx->egap_params.fw_egap_support = fw_egap_support; - qdf_spin_unlock_bh(&green_ap_ctx->lock); - - return QDF_STATUS_SUCCESS; -} - QDF_STATUS ucfg_green_ap_set_ps_config(struct wlan_objmgr_pdev *pdev, uint8_t value) { diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index e46e30a82c..508a4a0225 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -2091,6 +2091,12 @@ QDF_STATUS wmi_unified_extract_obss_detection_info(void *wmi_hdl, struct wmi_obss_detect_info *info); +#ifdef WLAN_SUPPORT_GREEN_AP +QDF_STATUS wmi_extract_green_ap_egap_status_info( + void *wmi_hdl, uint8_t *evt_buf, + struct wlan_green_ap_egap_status_info *egap_status_info_params); +#endif + #ifdef WLAN_SUPPORT_FILS /** * wmi_unified_fils_vdev_config_send_cmd() - send FILS config cmd to fw diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 50f80e4aa6..d50ed382c0 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -239,6 +239,10 @@ QDF_STATUS (*send_peer_create_cmd)(wmi_unified_t wmi, #ifdef WLAN_SUPPORT_GREEN_AP QDF_STATUS (*send_green_ap_ps_cmd)(wmi_unified_t wmi_handle, uint32_t value, uint8_t pdev_id); + +QDF_STATUS (*extract_green_ap_egap_status_info)( + uint8_t *evt_buf, + struct wlan_green_ap_egap_status_info *egap_status_info_params); #endif QDF_STATUS diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 16176acd49..720a209394 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -7351,3 +7351,18 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } + +#ifdef WLAN_SUPPORT_GREEN_AP +QDF_STATUS wmi_extract_green_ap_egap_status_info( + void *wmi_hdl, uint8_t *evt_buf, + struct wlan_green_ap_egap_status_info *egap_status_info_params) +{ + wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl; + + if (wmi_handle->ops->extract_green_ap_egap_status_info) + return wmi_handle->ops->extract_green_ap_egap_status_info( + evt_buf, egap_status_info_params); + + return QDF_STATUS_E_FAILURE; +} +#endif diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 3d4ab8f338..8a0c5262b6 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -21665,6 +21665,35 @@ static QDF_STATUS send_invoke_neighbor_report_cmd_tlv(wmi_unified_t wmi_handle, return status; } +#ifdef WLAN_SUPPORT_GREEN_AP +static QDF_STATUS extract_green_ap_egap_status_info_tlv( + uint8_t *evt_buf, + struct wlan_green_ap_egap_status_info *egap_status_info_params) +{ + WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *param_buf; + wmi_ap_ps_egap_info_event_fixed_param *egap_info_event; + wmi_ap_ps_egap_info_chainmask_list *chainmask_event; + + param_buf = (WMI_AP_PS_EGAP_INFO_EVENTID_param_tlvs *)evt_buf; + if (!param_buf) { + WMI_LOGE("Invalid EGAP Info status event buffer"); + return QDF_STATUS_E_INVAL; + } + + egap_info_event = (wmi_ap_ps_egap_info_event_fixed_param *) + param_buf->fixed_param; + chainmask_event = (wmi_ap_ps_egap_info_chainmask_list *) + param_buf->chainmask_list; + + egap_status_info_params->status = egap_info_event->status; + egap_status_info_params->mac_id = chainmask_event->mac_id; + egap_status_info_params->tx_chainmask = chainmask_event->tx_chainmask; + egap_status_info_params->rx_chainmask = chainmask_event->rx_chainmask; + + return QDF_STATUS_SUCCESS; +} +#endif + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -21842,6 +21871,8 @@ struct wmi_ops tlv_ops = { #ifdef WLAN_SUPPORT_GREEN_AP .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, + .extract_green_ap_egap_status_info = + extract_green_ap_egap_status_info_tlv, #endif .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv,