drivers/net/wireless/ath/ath11k/ce.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/ce.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/ce.c- Extension
.c- Size
- 25225 bytes
- Lines
- 1080
- 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
linux/export.hdp_rx.hdebug.hhif.h
Detected Declarations
function ath11k_ce_need_shadow_fixfunction ath11k_ce_stop_shadow_timersfunction ath11k_ce_rx_buf_enqueue_pipefunction ath11k_ce_rx_post_pipefunction ath11k_ce_completed_recv_nextfunction ath11k_ce_recv_process_cbfunction ath11k_ce_tx_process_cbfunction ath11k_ce_srng_msi_ring_params_setupfunction ath11k_ce_init_ringfunction ath11k_ce_alloc_ringfunction ath11k_ce_alloc_pipefunction ath11k_ce_per_engine_servicefunction ath11k_ce_poll_send_completedfunction ath11k_ce_sendfunction ath11k_ce_rx_pipe_cleanupfunction ath11k_ce_shadow_configfunction ath11k_ce_get_shadow_configfunction ath11k_ce_cleanup_pipesfunction ath11k_ce_rx_post_buffunction ath11k_ce_rx_replenish_retryfunction ath11k_ce_init_pipesfunction ath11k_ce_free_pipesfunction ath11k_ce_alloc_pipesfunction ath11k_ce_byte_swapfunction ath11k_ce_get_attr_flagsexport ath11k_ce_per_engine_serviceexport ath11k_ce_get_shadow_configexport ath11k_ce_cleanup_pipesexport ath11k_ce_rx_post_bufexport ath11k_ce_free_pipesexport ath11k_ce_alloc_pipesexport ath11k_ce_get_attr_flags
Annotated Snippet
if (!skb) {
ret = -ENOMEM;
goto exit;
}
WARN_ON_ONCE(!IS_ALIGNED((unsigned long)skb->data, 4));
paddr = dma_map_single(ab->dev, skb->data,
skb->len + skb_tailroom(skb),
DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(ab->dev, paddr))) {
ath11k_warn(ab, "failed to dma map ce rx buf\n");
dev_kfree_skb_any(skb);
ret = -EIO;
goto exit;
}
ATH11K_SKB_RXCB(skb)->paddr = paddr;
ret = ath11k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr);
if (ret) {
ath11k_dbg(ab, ATH11K_DBG_CE, "failed to enqueue rx buf: %d\n",
ret);
dma_unmap_single(ab->dev, paddr,
skb->len + skb_tailroom(skb),
DMA_FROM_DEVICE);
dev_kfree_skb_any(skb);
goto exit;
}
}
exit:
spin_unlock_bh(&ab->ce.ce_lock);
return ret;
}
static int ath11k_ce_completed_recv_next(struct ath11k_ce_pipe *pipe,
struct sk_buff **skb, int *nbytes)
{
struct ath11k_base *ab = pipe->ab;
struct hal_srng *srng;
unsigned int sw_index;
unsigned int nentries_mask;
u32 *desc;
int ret = 0;
spin_lock_bh(&ab->ce.ce_lock);
sw_index = pipe->dest_ring->sw_index;
nentries_mask = pipe->dest_ring->nentries_mask;
srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id];
spin_lock_bh(&srng->lock);
ath11k_hal_srng_access_begin(ab, srng);
desc = ath11k_hal_srng_dst_get_next_entry(ab, srng);
if (!desc) {
ret = -EIO;
goto err;
}
*nbytes = ath11k_hal_ce_dst_status_get_length(desc);
*skb = pipe->dest_ring->skb[sw_index];
pipe->dest_ring->skb[sw_index] = NULL;
sw_index = CE_RING_IDX_INCR(nentries_mask, sw_index);
pipe->dest_ring->sw_index = sw_index;
pipe->rx_buf_needed++;
err:
ath11k_hal_srng_access_end(ab, srng);
spin_unlock_bh(&srng->lock);
spin_unlock_bh(&ab->ce.ce_lock);
return ret;
}
static void ath11k_ce_recv_process_cb(struct ath11k_ce_pipe *pipe)
{
struct ath11k_base *ab = pipe->ab;
struct sk_buff *skb;
struct sk_buff_head list;
unsigned int nbytes, max_nbytes;
int ret;
Annotation
- Immediate include surface: `linux/export.h`, `dp_rx.h`, `debug.h`, `hif.h`.
- Detected declarations: `function ath11k_ce_need_shadow_fix`, `function ath11k_ce_stop_shadow_timers`, `function ath11k_ce_rx_buf_enqueue_pipe`, `function ath11k_ce_rx_post_pipe`, `function ath11k_ce_completed_recv_next`, `function ath11k_ce_recv_process_cb`, `function ath11k_ce_tx_process_cb`, `function ath11k_ce_srng_msi_ring_params_setup`, `function ath11k_ce_init_ring`, `function ath11k_ce_alloc_ring`.
- 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.