drivers/net/wireless/ath/ath12k/peer.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/peer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/peer.c- Extension
.c- Size
- 11580 bytes
- Lines
- 469
- 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.hdebugfs.h
Detected Declarations
function Copyrightfunction ath12k_peer_cleanupfunction ath12k_wait_for_peer_deletedfunction ath12k_wait_for_peer_delete_donefunction ath12k_peer_delete_sendfunction ath12k_peer_deletefunction ath12k_wait_for_peer_createdfunction ath12k_peer_createfunction ath12k_peer_ml_allocfunction ath12k_peer_mlo_link_peers_deletefunction ath12k_link_sta_rhash_insertfunction ath12k_link_sta_rhash_removefunction ath12k_link_sta_rhash_addfunction ath12k_link_sta_rhash_deletefunction ath12k_link_sta_rhash_tbl_initfunction ath12k_link_sta_rhash_tbl_destroy
Annotated Snippet
if (ret) {
ath12k_warn(ar->ab, "failed to delete peer vdev_id %d addr %pM\n",
arg->vdev_id, arg->peer_addr);
return ret;
}
ret = ath12k_wait_for_peer_delete_done(ar, arg->vdev_id,
arg->peer_addr);
if (ret)
return ret;
return -ENOENT;
}
peer->pdev_idx = ar->pdev_idx;
peer->sta = sta;
if (vif->type == NL80211_IFTYPE_STATION) {
dp_link_vif->ast_hash = peer->ast_hash;
dp_link_vif->ast_idx = peer->hw_peer_id;
}
if (sta) {
ahsta = ath12k_sta_to_ahsta(sta);
arsta = wiphy_dereference(ath12k_ar_to_hw(ar)->wiphy,
ahsta->link[link_id]);
/* TODO: Split DP related field usage to DP peer structure */
arsta->tcl_metadata = u16_encode_bits(0, HTT_TCL_META_DATA_TYPE) |
u16_encode_bits(peer->peer_id,
HTT_TCL_META_DATA_PEER_ID) |
u16_encode_bits(0, HTT_TCL_META_DATA_VALID_HTT);
arsta->ast_hash = peer->ast_hash;
arsta->ast_idx = peer->hw_peer_id;
peer->link_id = arsta->link_id;
/* Fill ML info into created peer */
if (sta->mlo) {
ml_peer_id = ahsta->ml_peer_id;
peer->ml_id = ml_peer_id | ATH12K_PEER_ML_ID_VALID;
ether_addr_copy(peer->ml_addr, sta->addr);
/* the assoc link is considered primary for now */
peer->primary_link = arsta->is_assoc_link;
peer->mlo = true;
} else {
peer->ml_id = ATH12K_MLO_PEER_ID_INVALID;
peer->primary_link = true;
peer->mlo = false;
}
}
ar->num_peers++;
spin_unlock_bh(&dp->dp_lock);
if (arvif->link_id < IEEE80211_MLD_MAX_NUM_LINKS) {
ret = ath12k_dp_link_peer_assign(ath12k_ab_to_dp(ar->ab),
&(ath12k_ar_to_ah(ar)->dp_hw),
arvif->vdev_id, sta,
(u8 *)arg->peer_addr, link_id,
ar->hw_link_id);
}
if (vif->type == NL80211_IFTYPE_AP && peer->dp_peer)
peer->dp_peer->ucast_ra_only = true;
return ret;
}
u16 ath12k_peer_ml_alloc(struct ath12k_hw *ah)
{
u16 ml_peer_id;
lockdep_assert_wiphy(ah->hw->wiphy);
for (ml_peer_id = 0; ml_peer_id < ATH12K_MAX_MLO_PEERS; ml_peer_id++) {
if (test_bit(ml_peer_id, ah->free_ml_peer_id_map))
continue;
set_bit(ml_peer_id, ah->free_ml_peer_id_map);
break;
}
if (ml_peer_id == ATH12K_MAX_MLO_PEERS)
ml_peer_id = ATH12K_MLO_PEER_ID_INVALID;
return ml_peer_id;
}
int ath12k_peer_mlo_link_peers_delete(struct ath12k_vif *ahvif, struct ath12k_sta *ahsta)
Annotation
- Immediate include surface: `core.h`, `peer.h`, `debug.h`, `debugfs.h`.
- Detected declarations: `function Copyright`, `function ath12k_peer_cleanup`, `function ath12k_wait_for_peer_deleted`, `function ath12k_wait_for_peer_delete_done`, `function ath12k_peer_delete_send`, `function ath12k_peer_delete`, `function ath12k_wait_for_peer_created`, `function ath12k_peer_create`, `function ath12k_peer_ml_alloc`, `function ath12k_peer_mlo_link_peers_delete`.
- 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.