From b629391f229386e055a66280d855dcc2f52d9aa2 Mon Sep 17 00:00:00 2001 From: Rahul Gusain Date: Thu, 2 Mar 2023 12:06:57 +0530 Subject: [PATCH] qcacmn: Extract MLD addr for BSSID In some scenarios, there can be need to get the peer MLD address. For this, add new API to extract the MLD address from the scan entry by the BSSID. Change-Id: I3b78501cb5320b3e834313a048b6fa0a84eab03b CRs-Fixed: 3441498 --- umac/scan/core/src/wlan_scan_cache_db.c | 28 +++++++++++++++++++++++++ umac/scan/core/src/wlan_scan_cache_db.h | 24 +++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index f79e537dc3..af913301bd 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -2186,6 +2186,34 @@ done: return status; } +#ifdef WLAN_FEATURE_11BE_MLO +QDF_STATUS scm_get_mld_addr_by_link_addr(struct wlan_objmgr_pdev *pdev, + struct qdf_mac_addr *link_addr, + struct qdf_mac_addr *mld_mac_addr) +{ + struct scan_cache_entry *entry = NULL; + + /* For ML connection, BSSID is link address */ + entry = scm_scan_get_entry_by_bssid(pdev, link_addr); + if (!entry) { + scm_err("scan entry not found for link addr: " QDF_MAC_ADDR_FMT, + QDF_MAC_ADDR_REF(link_addr)); + return QDF_STATUS_E_FAILURE; + } + + if (qdf_is_macaddr_zero(&entry->ml_info.mld_mac_addr)) { + util_scan_free_cache_entry(entry); + return QDF_STATUS_E_FAILURE; + } + + qdf_mem_copy(mld_mac_addr, &entry->ml_info.mld_mac_addr, + QDF_MAC_ADDR_SIZE); + util_scan_free_cache_entry(entry); + + return QDF_STATUS_SUCCESS; +} +#endif + struct scan_cache_entry * scm_scan_get_entry_by_bssid(struct wlan_objmgr_pdev *pdev, struct qdf_mac_addr *bssid) diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index 5341bbe6b6..ff1804350c 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -358,4 +358,28 @@ scm_scan_get_entry_by_mac_addr(struct wlan_objmgr_pdev *pdev, struct scan_cache_entry * scm_scan_get_entry_by_bssid(struct wlan_objmgr_pdev *pdev, struct qdf_mac_addr *bssid); + +#ifdef WLAN_FEATURE_11BE_MLO +/** + * scm_get_mld_addr_by_link_addr() - function to fetch the peer mld address from + * the scan entry for the given link address. + * @pdev: pdev object + * @link_addr: link address + * @mld_mac_addr: pointer to mld_mac_address + * + * Return : scan entry if found, else NULL + */ +QDF_STATUS +scm_get_mld_addr_by_link_addr(struct wlan_objmgr_pdev *pdev, + struct qdf_mac_addr *link_addr, + struct qdf_mac_addr *mld_mac_addr); +#else +static inline QDF_STATUS +scm_get_mld_addr_by_link_addr(struct wlan_objmgr_pdev *pdev, + struct qdf_mac_addr *link_addr, + struct qdf_mac_addr *mld_mac_addr) +{ + return QDF_STATUS_E_NOSUPPORT; +} +#endif #endif