drivers/net/wireless/ath/ath10k/wmi-tlv.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/wmi-tlv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/wmi-tlv.c- Extension
.c- Size
- 137652 bytes
- Lines
- 4654
- 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
core.hdebug.hmac.hhw.hwmi.hwmi-ops.hwmi-tlv.hp2p.htestmode.htxrx.hlinux/bitfield.h
Detected Declarations
struct wmi_tlv_policystruct wmi_tlv_tx_bundle_compl_parsestruct wmi_tlv_swba_parsestruct wmi_tlv_svc_rdy_parsefunction ath10k_wmi_tlv_iterfunction ath10k_wmi_tlv_iter_parsefunction ath10k_wmi_tlv_parsefunction ath10k_wmi_tlv_parse_allocfunction ath10k_wmi_tlv_lenfunction ath10k_wmi_tlv_event_bcn_tx_statusfunction ath10k_wmi_tlv_event_vdev_delete_respfunction ath10k_wmi_tlv_parse_peer_stats_infofunction ath10k_wmi_tlv_op_pull_peer_stats_infofunction ath10k_wmi_tlv_event_peer_stats_infofunction ath10k_wmi_tlv_event_diag_datafunction ath10k_wmi_tlv_event_diagfunction ath10k_wmi_tlv_event_p2p_noafunction ath10k_wmi_tlv_event_tx_pausefunction ath10k_wmi_tlv_event_rfkill_state_changefunction ath10k_wmi_tlv_event_temperaturefunction ath10k_wmi_event_tdls_peerfunction ath10k_wmi_tlv_event_peer_delete_respfunction ath10k_wmi_tlv_op_rxfunction ath10k_wmi_tlv_op_pull_scan_evfunction ath10k_wmi_tlv_op_pull_mgmt_tx_compl_evfunction ath10k_wmi_tlv_mgmt_tx_bundle_compl_parsefunction ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_evfunction ath10k_wmi_tlv_op_pull_mgmt_rx_evfunction ath10k_wmi_tlv_op_pull_ch_info_evfunction ath10k_wmi_tlv_op_pull_vdev_start_evfunction ath10k_wmi_tlv_op_pull_peer_kick_evfunction ath10k_wmi_tlv_swba_tim_parsefunction ath10k_wmi_tlv_swba_noa_parsefunction ath10k_wmi_tlv_swba_parsefunction ath10k_wmi_tlv_op_pull_swba_evfunction ath10k_wmi_tlv_op_pull_phyerr_ev_hdrfunction ath10k_wmi_tlv_parse_mem_reqsfunction ath10k_wmi_tlv_svc_rdy_parsefunction ath10k_wmi_tlv_op_pull_svc_rdy_evfunction ath10k_wmi_tlv_op_pull_rdy_evfunction ath10k_wmi_tlv_svc_avail_parsefunction ath10k_wmi_tlv_op_pull_svc_availfunction ath10k_wmi_tlv_pull_vdev_statsfunction ath10k_wmi_tlv_op_pull_fw_statsfunction ath10k_wmi_tlv_op_pull_roam_evfunction ath10k_wmi_tlv_op_pull_wow_evfunction ath10k_wmi_tlv_op_pull_echo_evfunction ath10k_wmi_tlv_op_gen_pdev_suspend
Annotated Snippet
struct wmi_tlv_policy {
size_t min_len;
};
static const struct wmi_tlv_policy wmi_tlv_policies[] = {
[WMI_TLV_TAG_ARRAY_BYTE]
= { .min_len = 0 },
[WMI_TLV_TAG_ARRAY_UINT32]
= { .min_len = 0 },
[WMI_TLV_TAG_STRUCT_SCAN_EVENT]
= { .min_len = sizeof(struct wmi_scan_event) },
[WMI_TLV_TAG_STRUCT_MGMT_RX_HDR]
= { .min_len = sizeof(struct wmi_tlv_mgmt_rx_ev) },
[WMI_TLV_TAG_STRUCT_CHAN_INFO_EVENT]
= { .min_len = sizeof(struct wmi_chan_info_event) },
[WMI_TLV_TAG_STRUCT_VDEV_START_RESPONSE_EVENT]
= { .min_len = sizeof(struct wmi_vdev_start_response_event) },
[WMI_TLV_TAG_STRUCT_PEER_STA_KICKOUT_EVENT]
= { .min_len = sizeof(struct wmi_peer_sta_kickout_event) },
[WMI_TLV_TAG_STRUCT_HOST_SWBA_EVENT]
= { .min_len = sizeof(struct wmi_host_swba_event) },
[WMI_TLV_TAG_STRUCT_TIM_INFO]
= { .min_len = sizeof(struct wmi_tim_info) },
[WMI_TLV_TAG_STRUCT_P2P_NOA_INFO]
= { .min_len = sizeof(struct wmi_p2p_noa_info) },
[WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT]
= { .min_len = sizeof(struct wmi_tlv_svc_rdy_ev) },
[WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES]
= { .min_len = sizeof(struct hal_reg_capabilities) },
[WMI_TLV_TAG_STRUCT_WLAN_HOST_MEM_REQ]
= { .min_len = sizeof(struct wlan_host_mem_req) },
[WMI_TLV_TAG_STRUCT_READY_EVENT]
= { .min_len = sizeof(struct wmi_tlv_rdy_ev) },
[WMI_TLV_TAG_STRUCT_OFFLOAD_BCN_TX_STATUS_EVENT]
= { .min_len = sizeof(struct wmi_tlv_bcn_tx_status_ev) },
[WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT]
= { .min_len = sizeof(struct wmi_tlv_diag_data_ev) },
[WMI_TLV_TAG_STRUCT_P2P_NOA_EVENT]
= { .min_len = sizeof(struct wmi_tlv_p2p_noa_ev) },
[WMI_TLV_TAG_STRUCT_ROAM_EVENT]
= { .min_len = sizeof(struct wmi_tlv_roam_ev) },
[WMI_TLV_TAG_STRUCT_WOW_EVENT_INFO]
= { .min_len = sizeof(struct wmi_tlv_wow_event_info) },
[WMI_TLV_TAG_STRUCT_TX_PAUSE_EVENT]
= { .min_len = sizeof(struct wmi_tlv_tx_pause_ev) },
};
static int
ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len,
int (*iter)(struct ath10k *ar, u16 tag, u16 len,
const void *ptr, void *data),
void *data)
{
const void *begin = ptr;
const struct wmi_tlv *tlv;
u16 tlv_tag, tlv_len;
int ret;
while (len > 0) {
if (len < sizeof(*tlv)) {
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi tlv parse failure at byte %zd (%zu bytes left, %zu expected)\n",
ptr - begin, len, sizeof(*tlv));
return -EINVAL;
}
tlv = ptr;
tlv_tag = __le16_to_cpu(tlv->tag);
tlv_len = __le16_to_cpu(tlv->len);
ptr += sizeof(*tlv);
len -= sizeof(*tlv);
if (tlv_len > len) {
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi tlv parse failure of tag %u at byte %zd (%zu bytes left, %u expected)\n",
tlv_tag, ptr - begin, len, tlv_len);
return -EINVAL;
}
if (tlv_tag < ARRAY_SIZE(wmi_tlv_policies) &&
wmi_tlv_policies[tlv_tag].min_len &&
wmi_tlv_policies[tlv_tag].min_len > tlv_len) {
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi tlv parse failure of tag %u at byte %zd (%u bytes is less than min length %zu)\n",
tlv_tag, ptr - begin, tlv_len,
wmi_tlv_policies[tlv_tag].min_len);
return -EINVAL;
}
ret = iter(ar, tlv_tag, tlv_len, ptr, data);
Annotation
- Immediate include surface: `core.h`, `debug.h`, `mac.h`, `hw.h`, `wmi.h`, `wmi-ops.h`, `wmi-tlv.h`, `p2p.h`.
- Detected declarations: `struct wmi_tlv_policy`, `struct wmi_tlv_tx_bundle_compl_parse`, `struct wmi_tlv_swba_parse`, `struct wmi_tlv_svc_rdy_parse`, `function ath10k_wmi_tlv_iter`, `function ath10k_wmi_tlv_iter_parse`, `function ath10k_wmi_tlv_parse`, `function ath10k_wmi_tlv_parse_alloc`, `function ath10k_wmi_tlv_len`, `function ath10k_wmi_tlv_event_bcn_tx_status`.
- 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.