From f3438c702a061795a89d261e88f3946fa4af548a Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Tue, 13 Dec 2022 17:53:13 +0530 Subject: [PATCH] qcacld-3.0: Fetch link freq based on link mac addr from roam sync Currently, link frequency is fetched from roam sync indication based on vdev_id. But the vdev_id is of assoc link in OWE/1x cases(where link vdev would be down as part of roam sync handling) but it would of non-assoc link in case of other modes like SAE/WPA2/.. So current fetching of frequency based vdev_id may give invalid frequency in SAE case as non-assoc link vdev_id is passed. Fetch the frequency based on link mac addr to avoid such failures. Change-Id: I0a5748ac351473d85b21f2da8d8f124715c4d595 CRs-Fixed: 3358448 --- .../umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h | 9 ++++----- .../umac/mlme/mlo_mgr/src/wlan_mlo_mgr_roam.c | 13 +++++++------ core/mac/src/pe/lim/lim_api.c | 12 +++++++++--- core/mac/src/pe/lim/lim_assoc_utils.c | 11 +++++++++++ core/mac/src/pe/lim/lim_assoc_utils.h | 12 ++++++++++++ 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/components/umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h b/components/umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h index 248cc195e6..af3d92f607 100644 --- a/components/umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h +++ b/components/umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h @@ -92,18 +92,17 @@ mlo_roam_get_chan_freq(uint8_t vdev_id, struct roam_offload_synch_ind *sync_ind); /** - * mlo_roam_get_link_freq - get given link frequency - * - * @vdev_id: vdev id + * mlo_roam_get_link_freq_from_mac_addr - get given link frequency * @sync_ind: roam sync ind pointer + * @link_mac_addr: Link mac address * * This api will be called to get the link frequency. * * Return: channel frequency */ uint32_t -mlo_roam_get_link_freq(uint8_t vdev_id, - struct roam_offload_synch_ind *sync_ind); +mlo_roam_get_link_freq_from_mac_addr(struct roam_offload_synch_ind *sync_ind, + uint8_t *link_mac_addr); /** * mlo_roam_get_link_id - get link id diff --git a/components/umac/mlme/mlo_mgr/src/wlan_mlo_mgr_roam.c b/components/umac/mlme/mlo_mgr/src/wlan_mlo_mgr_roam.c index 04d8910b77..b1d3930f27 100644 --- a/components/umac/mlme/mlo_mgr/src/wlan_mlo_mgr_roam.c +++ b/components/umac/mlme/mlo_mgr/src/wlan_mlo_mgr_roam.c @@ -426,18 +426,19 @@ bool is_multi_link_roam(struct roam_offload_synch_ind *sync_ind) } uint32_t -mlo_roam_get_link_freq(uint8_t vdev_id, - struct roam_offload_synch_ind *sync_ind) +mlo_roam_get_link_freq_from_mac_addr(struct roam_offload_synch_ind *sync_ind, + uint8_t *link_mac_addr) { uint8_t i; - if (!sync_ind || !sync_ind->num_setup_links) + if (!sync_ind || !sync_ind->num_setup_links || !link_mac_addr) return 0; - for (i = 0; i < sync_ind->num_setup_links; i++) { - if (sync_ind->ml_link[i].vdev_id != vdev_id) + for (i = 0; i < sync_ind->num_setup_links; i++) + if (!qdf_mem_cmp(sync_ind->ml_link[i].link_addr.bytes, + link_mac_addr, + QDF_MAC_ADDR_SIZE)) return sync_ind->ml_link[i].channel.mhz; - } return 0; } diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 4d1c2fb6a7..98c3c2122f 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -3954,7 +3954,7 @@ lim_gen_link_probe_rsp_roam(struct mac_context *mac_ctx, struct qdf_mac_addr sta_link_addr; QDF_STATUS status = QDF_STATUS_SUCCESS; tSirProbeRespBeacon *probe_rsp; - uint8_t *frame; + uint8_t *frame, *src_addr; uint32_t frame_len; struct wlan_frame_hdr *hdr; @@ -4016,10 +4016,16 @@ lim_gen_link_probe_rsp_roam(struct mac_context *mac_ctx, goto end; } + src_addr = lim_get_src_addr_from_frame(&link_probe_rsp); + if (!src_addr) { + pe_err("MLO: Failed to fetch src address"); + status = QDF_STATUS_E_FAILURE; + goto end; + } lim_add_bcn_probe(session->vdev, link_probe_rsp.ptr, link_probe_rsp.len, - mlo_roam_get_link_freq(session->vdev_id, - roam_sync_ind), + mlo_roam_get_link_freq_from_mac_addr( + roam_sync_ind, src_addr), roam_sync_ind->rssi); } else { qdf_mem_free(probe_rsp); diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 8cd46d3e65..ea1bb8dc85 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -4680,3 +4680,14 @@ void lim_extract_ies_from_deauth_disassoc(struct pe_session *session, mlme_set_peer_disconnect_ies(session->vdev, &ie); } +uint8_t *lim_get_src_addr_from_frame(struct element_info *frame) +{ + struct wlan_frame_hdr *hdr; + + if (!frame || !frame->len || frame->len < WLAN_MAC_HDR_LEN_3A) + return NULL; + + hdr = (struct wlan_frame_hdr *)frame->ptr; + + return hdr->i_addr2; +} diff --git a/core/mac/src/pe/lim/lim_assoc_utils.h b/core/mac/src/pe/lim/lim_assoc_utils.h index 2d31979fe9..609b7b070e 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.h +++ b/core/mac/src/pe/lim/lim_assoc_utils.h @@ -422,4 +422,16 @@ void lim_free_assoc_req_frm_buf(tpSirAssocReq assoc_req); bool lim_alloc_assoc_req_frm_buf(tpSirAssocReq assoc_req, qdf_nbuf_t buf, uint32_t mac_header_len, uint32_t frame_len); + +/** + * lim_get_src_addr_from_frame() - Get source address of the frame + * @frame: frame ptr + * + * Extract source mac address of the frame + * + * Return: Ptr for extracted src mac address + * + */ +uint8_t * +lim_get_src_addr_from_frame(struct element_info *frame); #endif /* __LIM_ASSOC_UTILS_H */