drivers/net/wireless/ath/ath11k/cfr.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/cfr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/cfr.c- Extension
.c- Size
- 26370 bytes
- Lines
- 1023
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
linux/relay.hcore.hdebug.h
Detected Declarations
function Copyrightfunction ath11k_cfr_calculate_tones_from_dma_hdrfunction ath11k_cfr_release_lut_entryfunction ath11k_cfr_rfs_writefunction ath11k_cfr_free_pending_dbr_eventsfunction ath11k_cfr_correlate_and_relayfunction ath11k_cfr_process_datafunction ath11k_cfr_fill_hdr_infofunction ath11k_process_cfr_capture_eventfunction ath11k_cfr_peer_is_in_cfr_unassoc_poolfunction ath11k_cfr_update_unassoc_pool_entryfunction ath11k_cfr_decrement_peer_countfunction ath11k_cfr_bw_to_fw_cfr_bwfunction ath11k_cfr_method_to_fw_cfr_methodfunction ath11k_cfr_send_peer_cfr_capture_cmdfunction ath11k_cfr_update_unassoc_poolfunction ath11k_read_file_enable_cfrfunction ath11k_write_file_enable_cfrfunction ath11k_write_file_cfr_unassocfunction ath11k_read_file_cfr_unassocfunction ath11k_cfr_debug_unregisterfunction ath11k_cfr_remove_buf_file_handlerfunction ath11k_cfr_debug_registerfunction ath11k_cfr_lut_update_paddrfunction ath11k_cfr_update_phymodefunction ath11k_cfr_ring_freefunction ath11k_cfr_ring_allocfunction ath11k_cfr_deinitfunction ath11k_cfr_init
Annotated Snippet
static const struct file_operations fops_enable_cfr = {
.read = ath11k_read_file_enable_cfr,
.write = ath11k_write_file_enable_cfr,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t ath11k_write_file_cfr_unassoc(struct file *file,
const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct ath11k *ar = file->private_data;
struct ath11k_cfr *cfr = &ar->cfr;
struct cfr_unassoc_pool_entry *entry;
char buf[64] = {};
u8 peer_mac[6];
u32 cfr_capture_enable;
u32 cfr_capture_period;
int available_idx = -1;
int ret, i;
simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
guard(mutex)(&ar->conf_mutex);
guard(spinlock_bh)(&cfr->lock);
if (ar->state != ATH11K_STATE_ON)
return -ENETDOWN;
if (!ar->cfr_enabled) {
ath11k_err(ar->ab, "CFR is not enabled on this pdev %d\n",
ar->pdev_idx);
return -EINVAL;
}
ret = sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %u %u",
&peer_mac[0], &peer_mac[1], &peer_mac[2], &peer_mac[3],
&peer_mac[4], &peer_mac[5], &cfr_capture_enable,
&cfr_capture_period);
if (ret < 1)
return -EINVAL;
if (cfr_capture_enable && ret != 8)
return -EINVAL;
if (!cfr_capture_enable) {
for (i = 0; i < ATH11K_MAX_CFR_ENABLED_CLIENTS; i++) {
entry = &cfr->unassoc_pool[i];
if (ether_addr_equal(peer_mac, entry->peer_mac)) {
memset(entry->peer_mac, 0, ETH_ALEN);
entry->is_valid = false;
cfr->cfr_enabled_peer_cnt--;
}
}
return count;
}
if (cfr->cfr_enabled_peer_cnt >= ATH11K_MAX_CFR_ENABLED_CLIENTS) {
ath11k_info(ar->ab, "Max cfr peer threshold reached\n");
return count;
}
for (i = 0; i < ATH11K_MAX_CFR_ENABLED_CLIENTS; i++) {
entry = &cfr->unassoc_pool[i];
if (available_idx < 0 && !entry->is_valid)
available_idx = i;
if (ether_addr_equal(peer_mac, entry->peer_mac)) {
ath11k_info(ar->ab,
"peer entry already present updating params\n");
entry->period = cfr_capture_period;
return count;
}
}
if (available_idx >= 0) {
entry = &cfr->unassoc_pool[available_idx];
ether_addr_copy(entry->peer_mac, peer_mac);
entry->period = cfr_capture_period;
entry->is_valid = true;
cfr->cfr_enabled_peer_cnt++;
}
return count;
}
Annotation
- Immediate include surface: `linux/relay.h`, `core.h`, `debug.h`.
- Detected declarations: `function Copyright`, `function ath11k_cfr_calculate_tones_from_dma_hdr`, `function ath11k_cfr_release_lut_entry`, `function ath11k_cfr_rfs_write`, `function ath11k_cfr_free_pending_dbr_events`, `function ath11k_cfr_correlate_and_relay`, `function ath11k_cfr_process_data`, `function ath11k_cfr_fill_hdr_info`, `function ath11k_process_cfr_capture_event`, `function ath11k_cfr_peer_is_in_cfr_unassoc_pool`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.