drivers/net/wireless/ath/ath12k/qmi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/qmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/qmi.c- Extension
.c- Size
- 104559 bytes
- Lines
- 4096
- 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.
- 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/elf.hqmi.hcore.hdebug.hlinux/of.hlinux/firmware.hlinux/of_address.hlinux/ioport.h
Detected Declarations
function ath12k_host_cap_hw_link_id_initfunction ath12k_host_cap_parse_mlofunction ath12k_qmi_host_cap_sendfunction ath12k_qmi_phy_cap_sendfunction ath12k_qmi_fw_ind_register_sendfunction ath12k_qmi_respond_fw_mem_requestfunction ath12k_qmi_reset_mlo_memfunction ath12k_qmi_free_mlo_mem_chunkfunction ath12k_qmi_free_target_mem_chunkfunction ath12k_qmi_alloc_chunkfunction ath12k_qmi_alloc_target_mem_chunkfunction ath12k_qmi_assign_target_mem_chunkfunction ath12k_qmi_request_target_capfunction ath12k_qmi_load_file_target_memfunction ath12k_qmi_load_bdf_qmifunction ath12k_qmi_m3_freefunction ath12k_qmi_m3_loadfunction ath12k_qmi_wlanfw_m3_info_sendfunction ath12k_qmi_aux_uc_freefunction ath12k_qmi_aux_uc_loadfunction ath12k_qmi_wlanfw_aux_uc_info_sendfunction ath12k_qmi_wlanfw_mode_sendfunction ath12k_qmi_wlanfw_wlan_cfg_sendfunction ath12k_qmi_wlanfw_wlan_ini_sendfunction ath12k_qmi_firmware_stopfunction ath12k_qmi_firmware_startfunction ath12k_qmi_driver_event_postfunction ath12k_qmi_trigger_host_capfunction ath12k_qmi_hw_group_host_cap_readyfunction ath12k_qmi_event_server_arrivefunction ath12k_qmi_event_mem_requestfunction ath12k_qmi_event_load_bdffunction ath12k_qmi_msg_mem_request_cbfunction ath12k_qmi_msg_mem_ready_cbfunction ath12k_qmi_msg_fw_ready_cbfunction ath12k_qmi_ops_new_serverfunction ath12k_qmi_ops_del_serverfunction ath12k_qmi_event_host_capfunction ath12k_qmi_driver_event_workfunction ath12k_qmi_init_servicefunction ath12k_qmi_deinit_servicefunction ath12k_qmi_free_resource
Annotated Snippet
if (partner_ab->device_id == ATH12K_INVALID_DEVICE_ID) {
ath12k_err(ab, "failed to send MLO cap due to invalid partner device id\n");
ret = -EINVAL;
goto device_cleanup;
}
info->chip_id = partner_ab->device_id;
info->num_local_links = partner_ab->qmi.num_radios;
ath12k_dbg(ab, ATH12K_DBG_QMI, "mlo device id %d num_link %d\n",
info->chip_id, info->num_local_links);
for (j = 0; j < info->num_local_links; j++) {
info->hw_link_id[j] = partner_ab->wsi_info.hw_link_id_base + j;
info->valid_mlo_link_id[j] = 1;
ath12k_dbg(ab, ATH12K_DBG_QMI, "mlo hw_link_id %d\n",
info->hw_link_id[j]);
hw_link_id++;
}
}
if (hw_link_id <= 0)
ag->mlo_capable = false;
req->mlo_chip_info_valid = 1;
mutex_unlock(&ag->mutex);
return 0;
device_cleanup:
for (i = i - 1; i >= 0; i--) {
info = &req->mlo_chip_info[i];
memset(info, 0, sizeof(*info));
}
req->mlo_num_chips = 0;
req->mlo_num_chips_valid = 0;
req->max_mlo_peer = 0;
req->max_mlo_peer_valid = 0;
req->mlo_group_id = 0;
req->mlo_group_id_valid = 0;
req->mlo_chip_id = 0;
req->mlo_chip_id_valid = 0;
req->mlo_capable = 0;
req->mlo_capable_valid = 0;
ag->mlo_capable = false;
mutex_unlock(&ag->mutex);
return ret;
}
/* clang stack usage explodes if this is inlined */
static noinline_for_stack
int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
{
struct qmi_wlanfw_host_cap_req_msg_v01 req = {};
struct qmi_wlanfw_host_cap_resp_msg_v01 resp = {};
struct qmi_txn txn;
int ret = 0;
req.num_clients_valid = 1;
req.num_clients = 1;
req.mem_cfg_mode = ab->qmi.target_mem_mode;
req.mem_cfg_mode_valid = 1;
req.bdf_support_valid = 1;
req.bdf_support = 1;
if (ab->hw_params->fw.m3_loader == ath12k_m3_fw_loader_driver) {
req.m3_support_valid = 1;
req.m3_support = 1;
req.m3_cache_support_valid = 1;
req.m3_cache_support = 1;
}
req.cal_done_valid = 1;
req.cal_done = ab->qmi.cal_done;
if (ab->hw_params->qmi_cnss_feature_bitmap) {
req.feature_list_valid = 1;
req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap;
}
/* BRINGUP: here we are piggybacking a lot of stuff using
Annotation
- Immediate include surface: `linux/elf.h`, `qmi.h`, `core.h`, `debug.h`, `linux/of.h`, `linux/firmware.h`, `linux/of_address.h`, `linux/ioport.h`.
- Detected declarations: `function ath12k_host_cap_hw_link_id_init`, `function ath12k_host_cap_parse_mlo`, `function ath12k_qmi_host_cap_send`, `function ath12k_qmi_phy_cap_send`, `function ath12k_qmi_fw_ind_register_send`, `function ath12k_qmi_respond_fw_mem_request`, `function ath12k_qmi_reset_mlo_mem`, `function ath12k_qmi_free_mlo_mem_chunk`, `function ath12k_qmi_free_target_mem_chunk`, `function ath12k_qmi_alloc_chunk`.
- 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.
- 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.