diff --git a/core/mac/src/pe/lim/lim_mlo.c b/core/mac/src/pe/lim/lim_mlo.c index 6c0985d61a..4e428ed05b 100644 --- a/core/mac/src/pe/lim/lim_mlo.c +++ b/core/mac/src/pe/lim/lim_mlo.c @@ -1391,7 +1391,13 @@ bool lim_is_emlsr_band_supported(struct pe_session *session) uint32_t freq; struct mlo_partner_info *partner_info; - partner_info = &session->lim_join_req->partner_info; + if (!session->lim_join_req) { + /* Initial connection */ + partner_info = &session->ml_partner_info; + } else { + /* Roaming */ + partner_info = &session->lim_join_req->partner_info; + } if (wlan_reg_is_24ghz_ch_freq(session->curr_op_freq)) { pe_debug("Pri link freq: %d, EMLSR mode not allowed", diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c index 51f428937b..2a657cf4e3 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c @@ -994,6 +994,62 @@ lim_process_assoc_rsp_t2lm(struct pe_session *session, } #endif +#ifdef WLAN_FEATURE_11BE_MLO +/** + * lim_cache_emlsr_params() - cache the EMLSR parameters in ML STA context + * @session_entry: session entry + * @assoc_rsp: pointer to parsed associate response + * + * Return: None + */ +static void lim_cache_emlsr_params(struct pe_session *session_entry, + tpSirAssocRsp assoc_rsp) +{ + struct wlan_mlo_sta *sta_ctx; + struct wlan_objmgr_vdev *vdev = session_entry->vdev; + struct emlsr_capability *ml_emlcap; + + wlan_objmgr_vdev_get_ref(vdev, WLAN_MLME_SB_ID); + if (!vdev) { + pe_err("vdev is null"); + return; + } + + if (!vdev->mlo_dev_ctx) { + pe_err("mlo dev ctx is null"); + goto end; + } + + sta_ctx = vdev->mlo_dev_ctx->sta_ctx; + if (!sta_ctx) { + pe_err("sta ctx is null"); + goto end; + } + + ml_emlcap = &sta_ctx->emlsr_cap; + + if (wlan_vdev_mlme_cap_get(vdev, + WLAN_VDEV_C_EMLSR_CAP)) { + ml_emlcap->emlsr_supp = true; + ml_emlcap->trans_timeout = + assoc_rsp->mlo_ie.mlo_ie.eml_capabilities_info.transition_timeout; + } else { + ml_emlcap->emlsr_supp = false; + ml_emlcap->trans_timeout = 0; + } + + pe_debug("EML caps support%d timeout%d", ml_emlcap->emlsr_supp, + ml_emlcap->trans_timeout); +end: + wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID); +} +#else +static inline void lim_cache_emlsr_params(struct pe_session *session_entry, + tpSirAssocRsp assoc_rsp) +{ +} +#endif + /** * lim_process_assoc_rsp_frame() - Processes assoc response * @mac_ctx: Pointer to Global MAC structure @@ -1445,6 +1501,13 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, lim_add_ft_sta_self(mac_ctx, (assoc_rsp->aid & 0x3FFF), session_entry); + } else { + lim_set_emlsr_caps(mac_ctx, session_entry); + lim_objmgr_update_emlsr_caps(mac_ctx->psoc, + session_entry->vdev_id, + assoc_rsp); + lim_cache_emlsr_params(session_entry, + assoc_rsp); } qdf_mem_free(beacon); return; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index a507955c9d..c669ef52d5 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -4393,8 +4393,7 @@ static void lim_fill_ml_info(struct cm_vdev_join_req *req, pe_join_req->assoc_link_id = req->assoc_link_id; } -static void lim_set_emlsr_caps(struct mac_context *mac_ctx, - struct pe_session *session) +void lim_set_emlsr_caps(struct mac_context *mac_ctx, struct pe_session *session) { bool emlsr_cap, emlsr_allowed, emlsr_band_check, emlsr_enabled = false; @@ -4428,11 +4427,6 @@ static void lim_fill_ml_info(struct cm_vdev_join_req *req, struct join_req *pe_join_req) { } - -static void lim_set_emlsr_caps(struct mac_context *mac_ctx, - struct pe_session *session) -{ -} #endif static QDF_STATUS diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 82127f8e9d..4f05662eb1 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -9357,49 +9357,54 @@ void lim_intersect_ap_emlsr_caps(struct mac_context *mac_ctx, struct bss_params *add_bss, tpSirAssocRsp assoc_rsp) { - struct wlan_mlo_peer_context *mlo_peer_ctx; - struct wlan_objmgr_peer *peer; + struct wlan_mlo_sta *sta_ctx; + struct wlan_objmgr_vdev *vdev = session->vdev; + struct emlsr_capability *ml_emlcap; - peer = wlan_objmgr_get_peer_by_mac(mac_ctx->psoc, add_bss->bssId, - WLAN_LEGACY_MAC_ID); - if (!peer) { - pe_err("peer is null"); + wlan_objmgr_vdev_get_ref(vdev, WLAN_MLME_NB_ID); + if (!vdev) { + pe_err("vdev is null"); return; } - mlo_peer_ctx = peer->mlo_peer_ctx; - if (!mlo_peer_ctx) { - pe_err("mlo peer ctx is null"); - wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); - return; + if (!vdev->mlo_dev_ctx) { + pe_err("mlo dev ctx is null"); + goto end; } - if (!wlan_vdev_mlme_cap_get(session->vdev, WLAN_VDEV_C_EMLSR_CAP)) { + sta_ctx = vdev->mlo_dev_ctx->sta_ctx; + if (!sta_ctx) { + pe_err("sta ctx is null"); + goto end; + } + + ml_emlcap = &sta_ctx->emlsr_cap; + + if (!wlan_vdev_mlme_cap_get(vdev, WLAN_VDEV_C_EMLSR_CAP)) { add_bss->staContext.emlsr_support = false; - wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); - return; + goto end; } if (wlan_vdev_mlme_is_mlo_link_vdev(session->vdev)) { - add_bss->staContext.emlsr_support = - mlo_peer_ctx->mlpeer_emlcap.emlsr_supp; + add_bss->staContext.emlsr_support = ml_emlcap->emlsr_supp; add_bss->staContext.emlsr_trans_timeout = - mlo_peer_ctx->mlpeer_emlcap.trans_timeout; + ml_emlcap->trans_timeout; } else { add_bss->staContext.emlsr_support = true; add_bss->staContext.emlsr_trans_timeout = - assoc_rsp->mlo_ie.mlo_ie.eml_capabilities_info.transition_timeout; + assoc_rsp->mlo_ie.mlo_ie.eml_capabilities_info.transition_timeout; - mlo_peer_ctx->mlpeer_emlcap.emlsr_supp = - add_bss->staContext.emlsr_support; - mlo_peer_ctx->mlpeer_emlcap.trans_timeout = - add_bss->staContext.emlsr_trans_timeout; + ml_emlcap->emlsr_supp = add_bss->staContext.emlsr_support; + ml_emlcap->trans_timeout = + add_bss->staContext.emlsr_trans_timeout; } - wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID); +end: pe_debug("emlsr support: %d, transition timeout:%d", add_bss->staContext.emlsr_support, add_bss->staContext.emlsr_trans_timeout); + + wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID); } #define MAX_MSD_OFDM_ED_THRESHOLD 10 diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 305f1a2b3a..6db4bf12ee 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -284,6 +284,17 @@ QDF_STATUS lim_send_mlo_caps_ie(struct mac_context *mac_ctx, */ void lim_strip_mlo_ie(struct mac_context *mac_ctx, uint8_t *add_ie, uint16_t *add_ielen); + +/** + * lim_set_emlsr_caps() - This API will set EMLSR caps in vdev obj if ELMSR is + * supported. + * @mac: mac context + * @pe_session: session entry + * + * Return: Void + */ +void lim_set_emlsr_caps(struct mac_context *mac_ctx, + struct pe_session *session); #else static inline uint16_t lim_assign_mlo_conn_idx(struct mac_context *mac, struct pe_session *pe_session, @@ -324,6 +335,11 @@ QDF_STATUS lim_send_mlo_caps_ie(struct mac_context *mac_ctx, { return QDF_STATUS_E_NOSUPPORT; } + +static inline void lim_set_emlsr_caps(struct mac_context *mac_ctx, + struct pe_session *session) +{ +} #endif void lim_enable_overlap11g_protection(struct mac_context *mac,