From f8d1f8ac6fa7fe67e74566652419318322acff98 Mon Sep 17 00:00:00 2001 From: jingxiang ge Date: Mon, 3 Jul 2023 16:20:22 +0800 Subject: [PATCH] qcacmn: Extract aux device capability Extract aux device capability from service ready ext2 event, and report such info to wma/mlme/hdd. Change-Id: I888624fd3443118ba66fadd7a40fcce4f4b5d521 CRs-Fixed: 3549753 --- target_if/core/inc/target_if.h | 2 + target_if/core/src/target_if_main.c | 1 + .../init_deinit/inc/service_ready_param.h | 23 +++++++ .../init_deinit/inc/service_ready_util.h | 28 +++++++++ .../init_deinit/src/init_event_handler.c | 8 +++ .../init_deinit/src/service_ready_util.c | 62 ++++++++++++++++++- wmi/inc/wmi_unified_api.h | 14 +++++ wmi/inc/wmi_unified_param.h | 21 ++++++- wmi/inc/wmi_unified_priv.h | 6 ++ wmi/src/wmi_unified_api.c | 14 +++++ wmi/src/wmi_unified_tlv.c | 44 +++++++++++++ 11 files changed, 219 insertions(+), 4 deletions(-) diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index efa23379c7..2e91c98659 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -209,6 +209,7 @@ struct target_version_info { * @device_mode: Global Device mode * @sbs_lower_band_end_freq: sbs lower band end frequency * @health_mon_param: health monitor params + * @aux_dev_caps: aux device capability */ struct tgt_info { struct host_fw_ver version; @@ -248,6 +249,7 @@ struct tgt_info { #ifdef HEALTH_MON_SUPPORT struct wmi_health_mon_params health_mon_param; #endif /* HEALTH_MON_SUPPORT */ + struct wlan_psoc_host_aux_dev_caps *aux_dev_caps; }; /** diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 8420ce55bf..4d34e90be1 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -796,6 +796,7 @@ QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc) init_deinit_spectral_scaling_params_free(tgt_psoc_info); init_deinit_scan_radio_cap_free(tgt_psoc_info); init_deinit_msdu_idx_qtype_map_free(tgt_psoc_info); + init_deinit_aux_dev_cap_free(tgt_psoc_info); qdf_event_destroy(&tgt_psoc_info->info.event); diff --git a/target_if/init_deinit/inc/service_ready_param.h b/target_if/init_deinit/inc/service_ready_param.h index 39f6f4976b..17cce4b723 100644 --- a/target_if/init_deinit/inc/service_ready_param.h +++ b/target_if/init_deinit/inc/service_ready_param.h @@ -410,6 +410,27 @@ struct wlan_psoc_host_chainmask_table { struct wlan_psoc_host_chainmask_capabilities *cap_list; }; +/* struct wlan_psoc_host_aux_dev_caps - wlan psoc aux dev capability. + * retrieved from wmi_aux_dev_capabilities. + * + * @aux_index: aux index + * @hw_mode_id:hw mode which defined in WMI_HW_MODE_CONFIG_TYPE + * @supported_modes_bitmap: indicate which mode this AUX supports for the + * HW mode defined in hw_mode_id. bitmap defined in + * WMI_AUX_DEV_CAPS_SUPPORTED_MODE. + * @listen_pdev_id_map: indicate which AUX MAC can listen/scan for the HW mode + * described in hw_mode_id + * @emlsr_pdev_id_map: indicate which AUX MAC can perform eMLSR for the HW mode + * described in hw_mode_id. + */ +struct wlan_psoc_host_aux_dev_caps { + uint32_t aux_index; + uint32_t hw_mode_id; + uint32_t supported_modes_bitmap; + uint32_t listen_pdev_id_map; + uint32_t emlsr_pdev_id_map; +}; + /** * struct wlan_psoc_host_service_ext_param - EXT service base params in event * @default_conc_scan_config_bits: Default concurrenct scan config @@ -482,6 +503,7 @@ struct wlan_psoc_host_service_ext_param { * mapping * @is_multipass_sap: Multipass sap flag * @num_max_mlo_link_per_ml_bss_supp: max link number per MLD FW supports. + * @num_aux_dev_caps: number of aux dev capabilities */ struct wlan_psoc_host_service_ext2_param { uint8_t reg_db_version_major; @@ -516,6 +538,7 @@ struct wlan_psoc_host_service_ext2_param { bool is_multipass_sap; #endif uint32_t num_max_mlo_link_per_ml_bss_supp; + uint32_t num_aux_dev_caps; }; #endif /* _SERVICE_READY_PARAM_H_*/ diff --git a/target_if/init_deinit/inc/service_ready_util.h b/target_if/init_deinit/inc/service_ready_util.h index 85644bc64d..f13456a069 100644 --- a/target_if/init_deinit/inc/service_ready_util.h +++ b/target_if/init_deinit/inc/service_ready_util.h @@ -256,6 +256,17 @@ QDF_STATUS init_deinit_msdu_idx_qtype_map_free( QDF_STATUS init_deinit_spectral_scaling_params_free( struct target_psoc_info *tgt_psoc_info); +/** + * init_deinit_aux_dev_cap_free() - free aux dev capability buffer + * @tgt_psoc_info: target psoc info object + * + * API to free aux dev capability buffer + * + * Return: QDF_STATUS + */ +QDF_STATUS init_deinit_aux_dev_cap_free( + struct target_psoc_info *tgt_psoc_info); + /** * init_deinit_populate_phy_reg_cap() - populate phy reg capability * @psoc: PSOC object @@ -374,6 +385,23 @@ int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc, uint8_t *event, struct tgt_info *info); +/** + * init_deinit_populate_aux_dev_cap_ext2() - populate aux dev capability + * from service ready ext2 event + * + * @psoc: PSOC object + * @handle: WMI handle pointer + * @event: event buffer received from FW + * @info: tgt_info object + * + * API to populate aux dev capability from service ready ext2 event. + * Return: zero on successful or failure + */ + +int init_deinit_populate_aux_dev_cap_ext2(struct wlan_objmgr_psoc *psoc, + wmi_unified_t handle, uint8_t *event, + struct tgt_info *info); + /** * init_deinit_populate_sap_coex_capability() - SAP coex capability * @psoc: PSOC object diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c index 8b4112457a..0e9cece0fb 100644 --- a/target_if/init_deinit/src/init_event_handler.c +++ b/target_if/init_deinit/src/init_event_handler.c @@ -587,6 +587,14 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle, if (err_code) target_if_debug("failed to populate sap_coex_capability ext2"); + if (info->service_ext2_param.num_aux_dev_caps) { + err_code = init_deinit_populate_aux_dev_cap_ext2(psoc, + wmi_handle, + event, info); + if (err_code) + target_if_debug("failed to populate aux_dev cap ext2"); + } + legacy_callback = target_if_get_psoc_legacy_service_ready_cb(); if (legacy_callback) if (legacy_callback(wmi_service_ready_ext2_event_id, diff --git a/target_if/init_deinit/src/service_ready_util.c b/target_if/init_deinit/src/service_ready_util.c index 7970f701b6..da9cb040be 100644 --- a/target_if/init_deinit/src/service_ready_util.c +++ b/target_if/init_deinit/src/service_ready_util.c @@ -246,7 +246,8 @@ static bool new_hw_mode_preferred(uint32_t current_hw_mode, { uint8_t hw_mode_id_precedence[WMI_HOST_HW_MODE_MAX + 1] = { 6, 2, 5, 4, 1, 3, - 7, 0, 8}; + 7, 8, 9, + 10, 0, 11}; if (current_hw_mode > WMI_HOST_HW_MODE_MAX || new_hw_mode > WMI_HOST_HW_MODE_MAX) @@ -607,6 +608,52 @@ exit: return qdf_status_to_os_return(status); } +int init_deinit_populate_aux_dev_cap_ext2(struct wlan_objmgr_psoc *psoc, + wmi_unified_t handle, uint8_t *event, + struct tgt_info *info) + +{ + uint8_t cap_idx; + uint32_t num_aux_dev_caps; + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct wlan_psoc_host_aux_dev_caps *param; + + num_aux_dev_caps = info->service_ext2_param.num_aux_dev_caps; + target_if_info("num_aux_dev_caps = %d", num_aux_dev_caps); + + if (!num_aux_dev_caps) + return 0; + + info->aux_dev_caps = + qdf_mem_malloc(sizeof(struct wlan_psoc_host_aux_dev_caps) * + num_aux_dev_caps); + + if (!info->aux_dev_caps) + return -EINVAL; + + for (cap_idx = 0; cap_idx < num_aux_dev_caps; cap_idx++) { + param = &info->aux_dev_caps[cap_idx]; + status = wmi_extract_aux_dev_cap_service_ready_ext2(handle, + event, + cap_idx, + param); + if (QDF_IS_STATUS_ERROR(status)) { + target_if_err("Extraction of aux dev cap failed"); + goto free_and_return; + } + } + + return 0; + +free_and_return: + qdf_mem_free(info->aux_dev_caps); + info->aux_dev_caps = NULL; + /* Set to 0 in case some code later rely on that */ + info->service_ext2_param.num_aux_dev_caps = 0; + + return qdf_status_to_os_return(status); +} + QDF_STATUS init_deinit_dbr_ring_cap_free( struct target_psoc_info *tgt_psoc_info) { @@ -637,6 +684,19 @@ QDF_STATUS init_deinit_spectral_scaling_params_free( qdf_export_symbol(init_deinit_spectral_scaling_params_free); +QDF_STATUS init_deinit_aux_dev_cap_free( + struct target_psoc_info *tgt_psoc_info) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + + if (tgt_psoc_info->info.aux_dev_caps) { + qdf_mem_free(tgt_psoc_info->info.aux_dev_caps); + tgt_psoc_info->info.aux_dev_caps = NULL; + } + + return status; +} + #ifdef DBS_SBS_BAND_LIMITATION_WAR #define phy0 0 #define phy2 2 diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 06158befed..caad38ab58 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -5163,6 +5163,20 @@ QDF_STATUS wmi_extract_sap_coex_cap_service_ready_ext2( uint8_t *evt_buf, struct wmi_host_coex_fix_chan_cap *cap); +/** + * wmi_extract_aux_dev_cap_service_ready_ext2() - extract aux dev capability + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @idx: capability index + * @param: psoc aux dev capability struct + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wmi_extract_aux_dev_cap_service_ready_ext2( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t idx, + struct wlan_psoc_host_aux_dev_caps *param); + /** * wmi_extract_csa_ie_received_event() - extract csa IE received event * @wmi_handle: wmi handle diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 54a7802fcd..d515a097e9 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -8154,7 +8154,7 @@ enum wmi_userspace_log_level { /** * enum wmi_host_hw_mode_config_type - HW mode config type replicated from - * FW header + * wmi_hw_mode_config_type in FW header * @WMI_HOST_HW_MODE_SINGLE: Only one PHY is active. * @WMI_HOST_HW_MODE_DBS: Both PHYs are active in different bands, * one in 2G and another in 5G. @@ -8170,8 +8170,20 @@ enum wmi_userspace_log_level { * as in WMI_HW_MODE_SBS, and 3rd on the other band * @WMI_HOST_HW_MODE_DBS_OR_SBS: Two PHY with one PHY capabale of both 2G and * 5G. It can support SBS (5G + 5G) OR DBS (5G + 2G). - * @WMI_HOST_HW_MODE_FW_INTERNAL: FW specific internal mode + * @WMI_HOST_HW_MODE_DBS_2G_5G: Both PHYs are active in different bands. + * PhyA 2G and PhyB 5G * @WMI_HOST_HW_MODE_2G_PHYB: Only one phy is active. 2G mode on PhyB. + * @WMI_HOST_HW_MODE_EMLSR: Both PHYs are active in listen mode in 1x1 + * and Tx/Rx trigger on any PHY will switch + * from 1x1 to 2x2 on that Phy + * @WMI_HOST_HW_MODE_AUX_EMLSR_SINGLE: PHYA0 and AUX are active in listen mode + * in 1x1 and Tx/Rx trigger on any. + * PHY will switch from 1x1 to 2x2 + * on that Phy. + * @WMI_HOST_HW_MODE_AUX_EMLSR_SPLIT: PHYA1 and AUX are active in listen mode + * in 1x1 and Tx/Rx trigger on any. + * PHY will switch from 1x1 to 2x2 + * on that Phy. * @WMI_HOST_HW_MODE_MAX: Max hw_mode_id. Used to indicate invalid mode. * @WMI_HOST_HW_MODE_DETECT: Mode id used by host to choose mode from target * supported modes. @@ -8183,8 +8195,11 @@ enum wmi_host_hw_mode_config_type { WMI_HOST_HW_MODE_SBS = 3, WMI_HOST_HW_MODE_DBS_SBS = 4, WMI_HOST_HW_MODE_DBS_OR_SBS = 5, - WMI_HOST_HW_MODE_FW_INTERNAL = 6, + WMI_HOST_HW_MODE_DBS_2G_5G = 6, WMI_HOST_HW_MODE_2G_PHYB = 7, + WMI_HOST_HW_MODE_EMLSR = 8, + WMI_HOST_HW_MODE_AUX_EMLSR_SINGLE = 9, + WMI_HOST_HW_MODE_AUX_EMLSR_SPLIT = 10, WMI_HOST_HW_MODE_MAX, WMI_HOST_HW_MODE_DETECT, }; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 3b8eb73bb0..34335cfaa4 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -3335,6 +3335,12 @@ QDF_STATUS (*extract_peer_entry_ptqm_migrate_event)( uint32_t index, struct peer_entry_ptqm_migrate_event_params *entry); #endif /* QCA_SUPPORT_PRIMARY_LINK_MIGRATE */ + +QDF_STATUS (*extract_aux_dev_cap_service_ready_ext2)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t idx, + struct wlan_psoc_host_aux_dev_caps *param); + }; /* Forward declaration for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 9ad802d457..b48e6910be 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -4059,3 +4059,17 @@ wmi_extract_csa_ie_received_event(wmi_unified_t wmi_handle, return QDF_STATUS_E_FAILURE; } + +QDF_STATUS wmi_extract_aux_dev_cap_service_ready_ext2( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t idx, + struct wlan_psoc_host_aux_dev_caps *param) +{ + if (wmi_handle->ops->extract_aux_dev_cap_service_ready_ext2) + return wmi_handle->ops->extract_aux_dev_cap_service_ready_ext2( + wmi_handle, + evt_buf, idx, param); + + return QDF_STATUS_E_FAILURE; +} + diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index cc038a7698..52318a5aaa 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -14558,6 +14558,8 @@ extract_service_ready_ext2_tlv(wmi_unified_t wmi_handle, uint8_t *event, extract_num_max_mlo_link(ev, param); + param->num_aux_dev_caps = param_buf->num_aux_dev_caps; + return QDF_STATUS_SUCCESS; } @@ -15257,6 +15259,46 @@ static QDF_STATUS extract_sw_cal_ver_ext2_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +static QDF_STATUS extract_aux_dev_cap_service_ready_ext2_tlv( + wmi_unified_t wmi_handle, + uint8_t *event, uint8_t idx, + struct wlan_psoc_host_aux_dev_caps *param) + +{ + WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *param_buf; + wmi_aux_dev_capabilities *aux_dev_caps; + + param_buf = (WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *)event; + + if (!param_buf->num_aux_dev_caps) + return QDF_STATUS_E_INVAL; + + if (!param_buf->aux_dev_caps) { + wmi_err("aux_dev_caps is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (idx >= param_buf->num_aux_dev_caps) + return QDF_STATUS_E_INVAL; + + aux_dev_caps = ¶m_buf->aux_dev_caps[idx]; + + param->aux_index = aux_dev_caps->aux_index; + param->hw_mode_id = aux_dev_caps->hw_mode_id; + param->supported_modes_bitmap = aux_dev_caps->supported_modes_bitmap; + param->listen_pdev_id_map = aux_dev_caps->listen_pdev_id_map; + param->emlsr_pdev_id_map = aux_dev_caps->emlsr_pdev_id_map; + + wmi_info("idx %u aux_index %u, hw_mode_id %u, supported_modes_bitmap 0x%x, listen_pdev_id_map 0x%x, emlsr_pdev_id_map 0x%x", + idx, aux_dev_caps->aux_index, + aux_dev_caps->hw_mode_id, + aux_dev_caps->supported_modes_bitmap, + aux_dev_caps->listen_pdev_id_map, + aux_dev_caps->emlsr_pdev_id_map); + + return QDF_STATUS_SUCCESS; +} + /** * wmi_tgt_thermal_level_to_host() - Convert target thermal level to host enum * @level: target thermal level from WMI_THERM_THROT_STATS_EVENTID event @@ -21127,6 +21169,8 @@ struct wmi_ops tlv_ops = { .extract_msdu_idx_qtype_map_service_ready_ext2 = extract_msdu_idx_qtype_map_service_ready_ext2_tlv, .extract_sw_cal_ver_ext2 = extract_sw_cal_ver_ext2_tlv, + .extract_aux_dev_cap_service_ready_ext2 = + extract_aux_dev_cap_service_ready_ext2_tlv, .extract_sar_cap_service_ready_ext = extract_sar_cap_service_ready_ext_tlv, .extract_pdev_utf_event = extract_pdev_utf_event_tlv,