drivers/net/wireless/ath/ath11k/peer.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/peer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/peer.c- Extension
.c- Size
- 15415 bytes
- Lines
- 671
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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.hpeer.hdebug.h
Detected Declarations
function Copyrightfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction ath11k_peer_unmap_eventfunction ath11k_peer_map_eventfunction ath11k_wait_for_peer_commonfunction ath11k_peer_rhash_insertfunction ath11k_peer_rhash_removefunction ath11k_peer_rhash_addfunction ath11k_peer_cleanupfunction ath11k_wait_for_peer_deletedfunction ath11k_wait_for_peer_delete_donefunction __ath11k_peer_deletefunction ath11k_peer_deletefunction ath11k_wait_for_peer_createdfunction ath11k_peer_createfunction ath11k_peer_rhash_deletefunction ath11k_peer_rhash_id_tbl_initfunction ath11k_peer_rhash_addr_tbl_initfunction ath11k_peer_rhash_id_tbl_destroyfunction ath11k_peer_rhash_addr_tbl_destroyfunction ath11k_peer_rhash_tbl_initfunction ath11k_peer_rhash_tbl_destroy
Annotated Snippet
if (vdev_id == peer->vdev_id) {
spin_unlock_bh(&ab->base_lock);
return peer;
}
}
spin_unlock_bh(&ab->base_lock);
return NULL;
}
void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id)
{
struct ath11k_peer *peer;
spin_lock_bh(&ab->base_lock);
peer = ath11k_peer_find_list_by_id(ab, peer_id);
if (!peer) {
ath11k_warn(ab, "peer-unmap-event: unknown peer id %d\n",
peer_id);
goto exit;
}
ath11k_dbg(ab, ATH11K_DBG_DP_HTT, "peer unmap vdev %d peer %pM id %d\n",
peer->vdev_id, peer->addr, peer_id);
list_del(&peer->list);
kfree(peer);
wake_up(&ab->peer_mapping_wq);
exit:
spin_unlock_bh(&ab->base_lock);
}
void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
u8 *mac_addr, u16 ast_hash, u16 hw_peer_id)
{
struct ath11k_peer *peer;
spin_lock_bh(&ab->base_lock);
peer = ath11k_peer_find(ab, 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);
list_add(&peer->list, &ab->peers);
wake_up(&ab->peer_mapping_wq);
}
ath11k_dbg(ab, ATH11K_DBG_DP_HTT, "peer map vdev %d peer %pM id %d\n",
vdev_id, mac_addr, peer_id);
exit:
spin_unlock_bh(&ab->base_lock);
}
static int ath11k_wait_for_peer_common(struct ath11k_base *ab, int vdev_id,
const u8 *addr, bool expect_mapped)
{
int ret;
ret = wait_event_timeout(ab->peer_mapping_wq, ({
bool mapped;
spin_lock_bh(&ab->base_lock);
mapped = !!ath11k_peer_find(ab, vdev_id, addr);
spin_unlock_bh(&ab->base_lock);
(mapped == expect_mapped ||
test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
}), 3 * HZ);
if (ret <= 0)
return -ETIMEDOUT;
return 0;
}
static inline int ath11k_peer_rhash_insert(struct ath11k_base *ab,
struct rhashtable *rtbl,
struct rhash_head *rhead,
struct rhashtable_params *params,
void *key)
{
struct ath11k_peer *tmp;
Annotation
- Immediate include surface: `core.h`, `peer.h`, `debug.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry`, `function list_for_each_entry`, `function list_for_each_entry`, `function ath11k_peer_unmap_event`, `function ath11k_peer_map_event`, `function ath11k_wait_for_peer_common`, `function ath11k_peer_rhash_insert`, `function ath11k_peer_rhash_remove`, `function ath11k_peer_rhash_add`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.