drivers/net/wireless/ath/ath12k/dp_peer.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/dp_peer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/dp_peer.c- Extension
.c- Size
- 17767 bytes
- Lines
- 691
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
core.hdp_peer.hdebug.hdebugfs.h
Detected Declarations
function Copyrightfunction ath12k_dp_link_peer_find_by_vdev_and_addrfunction list_for_each_entryfunction ath12k_dp_link_peer_find_by_pdev_and_addrfunction list_for_each_entryfunction ath12k_dp_link_peer_find_by_addrfunction ath12k_dp_link_peer_find_by_ml_idfunction ath12k_dp_link_peer_search_by_idfunction ath12k_dp_link_peer_exist_by_vdev_idfunction list_for_each_entryfunction ath12k_dp_link_peer_find_by_astfunction ath12k_dp_link_peer_unmap_eventfunction ath12k_dp_link_peer_map_eventfunction ath12k_dp_link_peer_rhash_addr_tbl_initfunction ath12k_dp_link_peer_rhash_tbl_initfunction ath12k_dp_link_peer_rhash_tbl_destroyfunction ath12k_dp_link_peer_rhash_insertfunction ath12k_dp_link_peer_rhash_removefunction ath12k_dp_link_peer_rhash_addfunction ath12k_dp_link_peer_rhash_deletefunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction ath12k_dp_link_peerfunction ath12k_dp_link_peer_find_by_peeridfunction ath12k_dp_peer_createfunction ath12k_dp_peer_deletefunction ath12k_dp_link_peer_assignfunction ath12k_dp_link_peer_unassignfunction ath12k_dp_link_peer_get_sta_rate_info_statsfunction ath12k_dp_link_peer_reset_rx_statsexport ath12k_dp_link_peer_find_by_addrexport ath12k_dp_peer_find_by_addrexport ath12k_dp_peer_find_by_peeridexport ath12k_dp_link_peer_find_by_peerid
Annotated Snippet
if (vdev_id == peer->vdev_id) {
spin_unlock_bh(&dp->dp_lock);
return true;
}
}
spin_unlock_bh(&dp->dp_lock);
return false;
}
struct ath12k_dp_link_peer *
ath12k_dp_link_peer_find_by_ast(struct ath12k_dp *dp, int ast_hash)
{
struct ath12k_dp_link_peer *peer;
lockdep_assert_held(&dp->dp_lock);
list_for_each_entry(peer, &dp->peers, list)
if (ast_hash == peer->ast_hash)
return peer;
return NULL;
}
void ath12k_dp_link_peer_unmap_event(struct ath12k_base *ab, u16 peer_id)
{
struct ath12k_dp_link_peer *peer;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
spin_lock_bh(&dp->dp_lock);
peer = ath12k_dp_link_peer_search_by_id(dp, peer_id);
if (!peer) {
ath12k_warn(ab, "peer-unmap-event: unknown peer id %d\n",
peer_id);
goto exit;
}
ath12k_dbg(ab, ATH12K_DBG_DP_HTT, "htt peer unmap vdev %d peer %pM id %d\n",
peer->vdev_id, peer->addr, peer_id);
ath12k_dp_link_peer_free(peer);
wake_up(&ab->peer_mapping_wq);
exit:
spin_unlock_bh(&dp->dp_lock);
}
void ath12k_dp_link_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id,
u8 *mac_addr, u16 ast_hash, u16 hw_peer_id)
{
struct ath12k_dp_link_peer *peer;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
struct ath12k *ar;
spin_lock_bh(&dp->dp_lock);
peer = ath12k_dp_link_peer_find_by_vdev_and_addr(dp, vdev_id, mac_addr);
if (!peer) {
peer = kzalloc_obj(*peer, GFP_ATOMIC);
if (!peer)
goto exit;
peer->vdev_id = vdev_id;
peer->peer_id = peer_id;
peer->ast_hash = ast_hash;
peer->hw_peer_id = hw_peer_id;
ether_addr_copy(peer->addr, mac_addr);
rcu_read_lock();
ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id);
if (ar && ath12k_debugfs_is_extd_rx_stats_enabled(ar) &&
!peer->peer_stats.rx_stats) {
peer->peer_stats.rx_stats = kzalloc_obj(*peer->peer_stats.rx_stats,
GFP_ATOMIC);
}
rcu_read_unlock();
list_add(&peer->list, &dp->peers);
wake_up(&ab->peer_mapping_wq);
ewma_avg_rssi_init(&peer->avg_rssi);
}
ath12k_dbg(ab, ATH12K_DBG_DP_HTT, "htt peer map vdev %d peer %pM id %d\n",
vdev_id, mac_addr, peer_id);
exit:
spin_unlock_bh(&dp->dp_lock);
}
struct ath12k_link_sta *ath12k_dp_link_peer_to_link_sta(struct ath12k_base *ab,
struct ath12k_dp_link_peer *peer)
{
Annotation
- Immediate include surface: `core.h`, `dp_peer.h`, `debug.h`, `debugfs.h`.
- Detected declarations: `function Copyright`, `function ath12k_dp_link_peer_find_by_vdev_and_addr`, `function list_for_each_entry`, `function ath12k_dp_link_peer_find_by_pdev_and_addr`, `function list_for_each_entry`, `function ath12k_dp_link_peer_find_by_addr`, `function ath12k_dp_link_peer_find_by_ml_id`, `function ath12k_dp_link_peer_search_by_id`, `function ath12k_dp_link_peer_exist_by_vdev_id`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.