qcacmn: Moving peer find function in common path

peer find by mac function is getting used by
many components. so, Movng that to common path.

Change-Id: I390b86af73618661857ed80d478fe4f48bee9fe1
CRs-Fixed: 3563204
This commit is contained in:
Gaurav Saini
2023-07-18 13:14:00 +05:30
committed by Rahul Choudhary
parent e5a70728b5
commit 552bef7535
2 changed files with 55 additions and 0 deletions

View File

@@ -266,6 +266,50 @@ QDF_STATUS dp_peer_ast_table_attach(struct dp_soc *soc)
return QDF_STATUS_SUCCESS; /* success */ return QDF_STATUS_SUCCESS; /* success */
} }
/**
* dp_find_peer_by_macaddr() - Finding the peer from mac address provided.
* @soc: soc handle
* @mac_addr: MAC address to be used to find peer
* @vdev_id: VDEV id
* @mod_id: MODULE ID
*
* Return: struct dp_peer
*/
struct dp_peer *dp_find_peer_by_macaddr(struct dp_soc *soc, uint8_t *mac_addr,
uint8_t vdev_id, enum dp_mod_id mod_id)
{
bool ast_ind_disable = wlan_cfg_get_ast_indication_disable(
soc->wlan_cfg_ctx);
struct cdp_peer_info peer_info = {0};
if ((!soc->ast_offload_support) || (!ast_ind_disable)) {
struct dp_ast_entry *ast_entry = NULL;
uint16_t peer_id;
qdf_spin_lock_bh(&soc->ast_lock);
ast_entry = dp_peer_ast_hash_find_by_vdevid(soc, mac_addr,
vdev_id);
if (!ast_entry) {
qdf_spin_unlock_bh(&soc->ast_lock);
dp_err("NULL ast entry");
return NULL;
}
peer_id = ast_entry->peer_id;
qdf_spin_unlock_bh(&soc->ast_lock);
if (peer_id == HTT_INVALID_PEER)
return NULL;
return dp_peer_get_ref_by_id(soc, peer_id, mod_id);
}
DP_PEER_INFO_PARAMS_INIT(&peer_info, vdev_id, mac_addr, false,
CDP_WILD_PEER_TYPE);
return dp_peer_hash_find_wrapper(soc, &peer_info, mod_id);
}
/** /**
* dp_peer_find_map_attach() - allocate memory for peer_id_to_obj_map * dp_peer_find_map_attach() - allocate memory for peer_id_to_obj_map
* @soc: soc handle * @soc: soc handle

View File

@@ -1315,6 +1315,17 @@ void dp_peer_find_map_detach(struct dp_soc *soc);
void dp_soc_wds_detach(struct dp_soc *soc); void dp_soc_wds_detach(struct dp_soc *soc);
QDF_STATUS dp_peer_ast_table_attach(struct dp_soc *soc); QDF_STATUS dp_peer_ast_table_attach(struct dp_soc *soc);
/**
* dp_find_peer_by_macaddr() - Finding the peer from mac address provided.
* @soc: soc handle
* @mac_addr: MAC address to be used to find peer
* @vdev_id: VDEV id
* @mod_id: MODULE ID
*
* Return: struct dp_peer
*/
struct dp_peer *dp_find_peer_by_macaddr(struct dp_soc *soc, uint8_t *mac_addr,
uint8_t vdev_id, enum dp_mod_id mod_id);
/** /**
* dp_peer_ast_hash_attach() - Allocate and initialize AST Hash Table * dp_peer_ast_hash_attach() - Allocate and initialize AST Hash Table
* @soc: SoC handle * @soc: SoC handle