drivers/net/wireless/ath/ath12k/dp.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/dp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/dp.c- Extension
.c- Size
- 42724 bytes
- Lines
- 1630
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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_tx.hhif.hhal.hdebug.hpeer.hdp_cmn.h
Detected Declarations
enum ath12k_dp_desc_typefunction ath12k_dp_peer_cleanupfunction ath12k_dp_peer_setupfunction ath12k_dp_srng_cleanupfunction ath12k_dp_srng_find_ring_in_maskfunction ath12k_dp_srng_calculate_msi_groupfunction ath12k_dp_srng_msi_setupfunction ath12k_dp_srng_setupfunction ath12k_dp_tx_get_bank_profilefunction ath12k_dp_tx_put_bank_profilefunction ath12k_dp_deinit_bank_profilesfunction ath12k_dp_init_bank_profilesfunction ath12k_dp_srng_common_cleanupfunction ath12k_dp_srng_common_setupfunction ath12k_dp_scatter_idle_link_desc_cleanupfunction ath12k_dp_scatter_idle_link_desc_setupfunction ath12k_dp_link_desc_bank_freefunction ath12k_dp_link_desc_bank_allocfunction ath12k_dp_link_desc_cleanupfunction ath12k_wbm_idle_ring_setupfunction ath12k_dp_link_desc_setupfunction ath12k_dp_pdev_freefunction ath12k_dp_pdev_pre_allocfunction ath12k_dp_pdev_allocfunction ath12k_dp_update_vdev_searchfunction ath12k_dp_vdev_tx_attachfunction ath12k_dp_cc_cleanupfunction list_for_each_entry_safefunction ath12k_dp_reoq_lut_cleanupfunction ath12k_dp_cleanupfunction ath12k_dp_cc_cookie_genfunction ath12k_dp_cc_desc_initfunction ath12k_dp_cmem_initfunction ath12k_dp_partner_cc_initfunction ath12k_dp_get_num_spt_pagesfunction ath12k_dp_cc_initfunction ath12k_dp_alloc_reoq_lutfunction ath12k_dp_reoq_lut_setupfunction ath12k_dp_setupfunction ath12k_dp_cmn_device_deinitfunction ath12k_dp_cmn_device_initfunction ath12k_dp_cmn_hw_group_unassignfunction ath12k_dp_cmn_hw_group_assignexport ath12k_dp_get_rx_descexport ath12k_dp_get_tx_desc
Annotated Snippet
if (ret) {
ath12k_warn(ab, "failed to setup rxd tid queue for tid %d: %d\n",
tid, ret);
goto peer_clean;
}
}
ret = ath12k_dp_rx_peer_frag_setup(ar, addr, vdev_id);
if (ret) {
ath12k_warn(ab, "failed to setup rx defrag context\n");
goto peer_clean;
}
/* TODO: Setup other peer specific resource used in data path */
return 0;
peer_clean:
spin_lock_bh(&dp->dp_lock);
peer = ath12k_dp_link_peer_find_by_vdev_and_addr(dp, vdev_id, addr);
if (!peer) {
ath12k_warn(ab, "failed to find the peer to del rx tid\n");
spin_unlock_bh(&dp->dp_lock);
return -ENOENT;
}
for (tid--; tid >= 0; tid--)
ath12k_dp_arch_rx_peer_tid_delete(dp, peer, tid);
spin_unlock_bh(&dp->dp_lock);
return ret;
}
void ath12k_dp_srng_cleanup(struct ath12k_base *ab, struct dp_srng *ring)
{
if (!ring->vaddr_unaligned)
return;
dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned,
ring->paddr_unaligned);
ring->vaddr_unaligned = NULL;
}
static int ath12k_dp_srng_find_ring_in_mask(int ring_num, const u8 *grp_mask)
{
int ext_group_num;
u8 mask = 1 << ring_num;
for (ext_group_num = 0; ext_group_num < ATH12K_EXT_IRQ_GRP_NUM_MAX;
ext_group_num++) {
if (mask & grp_mask[ext_group_num])
return ext_group_num;
}
return -ENOENT;
}
static int ath12k_dp_srng_calculate_msi_group(struct ath12k_base *ab,
enum hal_ring_type type, int ring_num)
{
const struct ath12k_hal_tcl_to_wbm_rbm_map *map;
const u8 *grp_mask;
int i;
switch (type) {
case HAL_WBM2SW_RELEASE:
if (ring_num == HAL_WBM2SW_REL_ERR_RING_NUM) {
grp_mask = &ab->hw_params->ring_mask->rx_wbm_rel[0];
ring_num = 0;
} else {
map = ab->hal.tcl_to_wbm_rbm_map;
for (i = 0; i < ab->hw_params->max_tx_ring; i++) {
if (ring_num == map[i].wbm_ring_num) {
ring_num = i;
break;
}
}
grp_mask = &ab->hw_params->ring_mask->tx[0];
}
break;
case HAL_REO_EXCEPTION:
grp_mask = &ab->hw_params->ring_mask->rx_err[0];
break;
case HAL_REO_DST:
grp_mask = &ab->hw_params->ring_mask->rx[0];
break;
Annotation
- Immediate include surface: `core.h`, `dp_tx.h`, `hif.h`, `hal.h`, `debug.h`, `peer.h`, `dp_cmn.h`.
- Detected declarations: `enum ath12k_dp_desc_type`, `function ath12k_dp_peer_cleanup`, `function ath12k_dp_peer_setup`, `function ath12k_dp_srng_cleanup`, `function ath12k_dp_srng_find_ring_in_mask`, `function ath12k_dp_srng_calculate_msi_group`, `function ath12k_dp_srng_msi_setup`, `function ath12k_dp_srng_setup`, `function ath12k_dp_tx_get_bank_profile`, `function ath12k_dp_tx_put_bank_profile`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.