From ef640697c4c34aca1e804054910dd05f62acbdf8 Mon Sep 17 00:00:00 2001 From: Shreedhar Parande Date: Fri, 29 Sep 2023 22:57:23 +0530 Subject: [PATCH] qcacmn: Add API to check active link in all MLDs Add API to check active link in all MLDs. Change-Id: Iec05b37543718f2f79dab0fa0201aac93431d46f CRs-Fixed: 3635226 --- umac/mlo_mgr/inc/wlan_mlo_mgr_main.h | 20 +++++++ .../mlo_mgr/inc/wlan_mlo_mgr_public_structs.h | 2 + umac/mlo_mgr/src/wlan_mlo_mgr_main.c | 56 +++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h index 07c4138985..749bac6856 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h @@ -1002,6 +1002,20 @@ QDF_STATUS wlan_mlo_mgr_mld_vdev_attach(struct wlan_objmgr_vdev *vdev, QDF_STATUS wlan_mlo_mgr_mld_vdev_detach(struct wlan_objmgr_vdev *vdev); #ifdef WLAN_MLO_MULTI_CHIP +/** + * mlo_mgr_is_mld_has_active_link() - Check if any MLD has active link + * + * @is_active: Buffer indicating links are active or not + * + * The API iterates through all the ML dev ctx in the global MLO + * manager to check if there is atleast one active link present in + * any of the MLDs + * + * Return: QDF_STATUS_SUCCESS if link information is retrieved + * successfully else QDF_STATUS_E*. + */ +QDF_STATUS mlo_mgr_is_mld_has_active_link(bool *is_active); + #ifdef WLAN_WSI_STATS_SUPPORT /** * mlo_wsi_link_info_update_soc() - Update PSOC group in WSI stats @@ -1020,6 +1034,12 @@ static void mlo_wsi_link_info_update_soc(struct wlan_objmgr_psoc *psoc, { } #endif +#else +static inline +QDF_STATUS mlo_mgr_is_mld_has_active_link(bool *is_active) +{ + return QDF_STATUS_E_FAILURE; +} #endif #else diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h index c260988e84..62923903a3 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h @@ -354,6 +354,7 @@ struct mlo_wsi_info { * @force_non_assoc_prim_umac: Force non-assoc link to be primary umac * @lswitch_notifier: Link switch notifier callbacks * @wsi_info: WSI stats info + * @disable_eml: Disable Enhanced Multi Link features(eMLSR and eMLMR). */ struct mlo_mgr_context { #ifdef WLAN_MLO_USE_SPINLOCK @@ -385,6 +386,7 @@ struct mlo_mgr_context { struct wlan_mlo_link_switch_notifier lswitch_notifier[WLAN_UMAC_COMP_ID_MAX]; #endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */ struct mlo_wsi_info *wsi_info; + bool disable_eml; }; /** diff --git a/umac/mlo_mgr/src/wlan_mlo_mgr_main.c b/umac/mlo_mgr/src/wlan_mlo_mgr_main.c index cc5da6efa6..316b2e8280 100644 --- a/umac/mlo_mgr/src/wlan_mlo_mgr_main.c +++ b/umac/mlo_mgr/src/wlan_mlo_mgr_main.c @@ -544,6 +544,62 @@ bool wlan_mlo_is_mld_ctx_exist(struct qdf_mac_addr *mldaddr) return false; } +#ifdef WLAN_MLO_MULTI_CHIP +QDF_STATUS mlo_mgr_is_mld_has_active_link(bool *is_active) +{ + qdf_list_t *ml_list; + uint32_t idx, count; + struct wlan_mlo_dev_context *mld_cur, *mld_next; + struct wlan_objmgr_vdev *vdev; + struct mlo_mgr_context *g_mlo_ctx = wlan_objmgr_get_mlo_ctx(); + QDF_STATUS status; + + if (!g_mlo_ctx || !is_active) + return QDF_STATUS_E_FAILURE; + + ml_link_lock_acquire(g_mlo_ctx); + ml_list = &g_mlo_ctx->ml_dev_list; + if (!qdf_list_size(ml_list)) { + ml_link_lock_release(g_mlo_ctx); + return QDF_STATUS_E_FAILURE; + } + + *is_active = false; + mld_cur = wlan_mlo_list_peek_head(ml_list); + while (mld_cur) { + mlo_dev_lock_acquire(mld_cur); + count = QDF_ARRAY_SIZE(mld_cur->wlan_vdev_list); + for (idx = 0; idx < count; idx++) { + vdev = mld_cur->wlan_vdev_list[idx]; + if (!vdev) + continue; + + status = wlan_vdev_mlme_is_init_state(vdev); + if (QDF_STATUS_SUCCESS == status) + continue; + + qdf_err("VDEV [vdev_id %u, pdev_id %u, psoc_id %u, state %u] is still active", + wlan_vdev_get_id(vdev), + wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev)), + wlan_vdev_get_psoc_id(vdev), + wlan_vdev_mlme_get_state(vdev)); + *is_active = true; + mlo_dev_lock_release(mld_cur); + ml_link_lock_release(g_mlo_ctx); + return QDF_STATUS_SUCCESS; + } + mld_next = wlan_mlo_get_next_mld_ctx(ml_list, mld_cur); + mlo_dev_lock_release(mld_cur); + mld_cur = mld_next; + } + ml_link_lock_release(g_mlo_ctx); + + return QDF_STATUS_SUCCESS; +} + +qdf_export_symbol(mlo_mgr_is_mld_has_active_link); +#endif + #ifdef WLAN_FEATURE_11BE_MLO bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr, uint8_t *peer_vdev_id)