drivers/net/wireless/ath/ath10k/testmode.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/testmode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/testmode.c- Extension
.c- Size
- 16206 bytes
- Lines
- 663
- 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
testmode.hnet/netlink.hlinux/firmware.hdebug.hwmi.hwmi-tlv.hhif.hhw.hcore.htestmode_i.h
Detected Declarations
function ath10k_tm_event_unsegmentedfunction ath10k_tm_event_segmentedfunction ath10k_tm_event_wmifunction ath10k_tm_cmd_get_versionfunction ath10k_tm_fetch_utf_firmware_api_1function ath10k_tm_fetch_firmwarefunction ath10k_tm_cmd_utf_startfunction __ath10k_tm_cmd_utf_stopfunction ath10k_tm_cmd_utf_stopfunction ath10k_tm_cmd_wmifunction ath10k_tm_cmd_tlvfunction ath10k_tm_cmdfunction ath10k_testmode_destroy
Annotated Snippet
if (ret) {
ath10k_warn(ar,
"failed to init utf code swap segment: %d\n",
ret);
goto err_release_utf_mode_fw;
}
}
spin_lock_bh(&ar->data_lock);
ar->testmode.utf_monitor = true;
spin_unlock_bh(&ar->data_lock);
ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode wmi version %d\n",
ar->testmode.utf_mode_fw.fw_file.wmi_op_version);
ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_UTF);
if (ret) {
ath10k_err(ar, "failed to power up hif (testmode): %d\n", ret);
ar->state = ATH10K_STATE_OFF;
goto err_release_utf_mode_fw;
}
ar->testmode.eventdata = kzalloc(ATH_FTM_EVENT_MAX_BUF_LENGTH, GFP_KERNEL);
if (!ar->testmode.eventdata) {
ret = -ENOMEM;
goto err_power_down;
}
ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_UTF,
&ar->testmode.utf_mode_fw);
if (ret) {
ath10k_err(ar, "failed to start core (testmode): %d\n", ret);
ar->state = ATH10K_STATE_OFF;
goto err_release_eventdata;
}
ar->state = ATH10K_STATE_UTF;
if (strlen(ar->testmode.utf_mode_fw.fw_file.fw_version) > 0)
ver = ar->testmode.utf_mode_fw.fw_file.fw_version;
else
ver = "API 1";
ath10k_info(ar, "UTF firmware %s started\n", ver);
mutex_unlock(&ar->conf_mutex);
return 0;
err_release_eventdata:
kfree(ar->testmode.eventdata);
ar->testmode.eventdata = NULL;
err_power_down:
ath10k_hif_power_down(ar);
err_release_utf_mode_fw:
if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
ar->testmode.utf_mode_fw.fw_file.codeswap_len)
ath10k_swap_code_seg_release(ar,
&ar->testmode.utf_mode_fw.fw_file);
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
err:
mutex_unlock(&ar->conf_mutex);
return ret;
}
static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
{
lockdep_assert_held(&ar->conf_mutex);
ath10k_core_stop(ar);
ath10k_hif_power_down(ar);
spin_lock_bh(&ar->data_lock);
ar->testmode.utf_monitor = false;
spin_unlock_bh(&ar->data_lock);
if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
ar->testmode.utf_mode_fw.fw_file.codeswap_len)
ath10k_swap_code_seg_release(ar,
&ar->testmode.utf_mode_fw.fw_file);
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
Annotation
- Immediate include surface: `testmode.h`, `net/netlink.h`, `linux/firmware.h`, `debug.h`, `wmi.h`, `wmi-tlv.h`, `hif.h`, `hw.h`.
- Detected declarations: `function ath10k_tm_event_unsegmented`, `function ath10k_tm_event_segmented`, `function ath10k_tm_event_wmi`, `function ath10k_tm_cmd_get_version`, `function ath10k_tm_fetch_utf_firmware_api_1`, `function ath10k_tm_fetch_firmware`, `function ath10k_tm_cmd_utf_start`, `function __ath10k_tm_cmd_utf_stop`, `function ath10k_tm_cmd_utf_stop`, `function ath10k_tm_cmd_wmi`.
- 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.