From 2e13c17be46319a7c2bb6b9bebd3f6bfca4f21df Mon Sep 17 00:00:00 2001 From: Neha Bisht Date: Thu, 14 Sep 2023 12:59:44 +0530 Subject: [PATCH] qcacmn: Add API to fetch ast entry by mac and ast type Add API to fetch ast entry by mac and ast type Change-Id: Ib8cfa5c269fd10c149804d02fcfae35e88c2a53f CRs-Fixed: 3614965 --- dp/wifi3.0/be/dp_be.c | 5 ++++- dp/wifi3.0/dp_peer.c | 35 +++++++++++++++++++++++++++++++++++ dp/wifi3.0/dp_peer.h | 17 +++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/be/dp_be.c b/dp/wifi3.0/be/dp_be.c index 0d6e2c33a5..07a38e4dc1 100644 --- a/dp/wifi3.0/be/dp_be.c +++ b/dp/wifi3.0/be/dp_be.c @@ -3894,7 +3894,10 @@ QDF_STATUS dp_htt_reo_migration(struct dp_soc *soc, uint16_t peer_id, /* delete ast entry for current primary peer */ qdf_spin_lock_bh(¤t_pr_soc->ast_lock); - ast_entry = dp_peer_ast_hash_find_soc(current_pr_soc, mld_peer->mac_addr.raw); + ast_entry = dp_peer_ast_hash_find_soc_by_type( + current_pr_soc, + mld_peer->mac_addr.raw, + CDP_TXRX_AST_TYPE_MLD); if (!ast_entry) { dp_htt_err("Invalid ast entry"); qdf_spin_unlock_bh(¤t_pr_soc->ast_lock); diff --git a/dp/wifi3.0/dp_peer.c b/dp/wifi3.0/dp_peer.c index 7663c768aa..265c32dd49 100644 --- a/dp/wifi3.0/dp_peer.c +++ b/dp/wifi3.0/dp_peer.c @@ -1289,6 +1289,33 @@ struct dp_ast_entry *dp_peer_ast_hash_find_soc(struct dp_soc *soc, return NULL; } +struct dp_ast_entry *dp_peer_ast_hash_find_soc_by_type( + struct dp_soc *soc, + uint8_t *ast_mac_addr, + enum cdp_txrx_ast_entry_type type) +{ + union dp_align_mac_addr local_mac_addr_aligned, *mac_addr; + unsigned index; + struct dp_ast_entry *ase; + + if (!soc->ast_hash.bins) + return NULL; + + qdf_mem_copy(&local_mac_addr_aligned.raw[0], + ast_mac_addr, QDF_MAC_ADDR_SIZE); + mac_addr = &local_mac_addr_aligned; + + index = dp_peer_ast_hash_index(soc, mac_addr); + TAILQ_FOREACH(ase, &soc->ast_hash.bins[index], hash_list_elem) { + if (dp_peer_find_mac_addr_cmp(mac_addr, &ase->mac_addr) == 0 && + ase->type == type) { + return ase; + } + } + + return NULL; +} + /** * dp_peer_map_ipa_evt() - Send peer map event to IPA * @soc: SoC handle @@ -2164,6 +2191,14 @@ struct dp_ast_entry *dp_peer_ast_hash_find_soc(struct dp_soc *soc, return NULL; } +struct dp_ast_entry *dp_peer_ast_hash_find_soc_by_type( + struct dp_soc *soc, + uint8_t *ast_mac_addr, + enum cdp_txrx_ast_entry_type type) +{ + return NULL; +} + static inline QDF_STATUS dp_peer_host_add_map_ast(struct dp_soc *soc, uint16_t peer_id, uint8_t *mac_addr, uint16_t hw_peer_id, diff --git a/dp/wifi3.0/dp_peer.h b/dp/wifi3.0/dp_peer.h index 1afcd28bf5..98058cae74 100644 --- a/dp/wifi3.0/dp_peer.h +++ b/dp/wifi3.0/dp_peer.h @@ -896,6 +896,23 @@ struct dp_ast_entry *dp_peer_ast_hash_find_by_vdevid(struct dp_soc *soc, struct dp_ast_entry *dp_peer_ast_hash_find_soc(struct dp_soc *soc, uint8_t *ast_mac_addr); +/** + * dp_peer_ast_hash_find_soc_by_type() - Find AST entry by MAC address + * and AST type + * @soc: SoC handle + * @ast_mac_addr: Mac address + * @type: AST entry type + * + * It assumes caller has taken the ast lock to protect the access to + * AST hash table + * + * Return: AST entry + */ +struct dp_ast_entry *dp_peer_ast_hash_find_soc_by_type( + struct dp_soc *soc, + uint8_t *ast_mac_addr, + enum cdp_txrx_ast_entry_type type); + /** * dp_peer_ast_get_pdev_id() - get pdev_id from the ast entry * @soc: SoC handle