drivers/net/wireless/ath/ath10k/wmi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/wmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/wmi.c- Extension
.c- Size
- 322247 bytes
- Lines
- 9641
- 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/skbuff.hlinux/ctype.hcore.hhtc.hdebug.hwmi.hwmi-tlv.hmac.htestmode.hwmi-ops.hp2p.hhw.hhif.htxrx.h
Detected Declarations
function ath10k_wmi_put_wmi_channelfunction ath10k_wmi_wait_for_service_readyfunction ath10k_wmi_wait_for_unified_readyfunction ath10k_wmi_htc_tx_completefunction ath10k_wmi_cmd_send_nowaitfunction ath10k_wmi_tx_beacon_nowaitfunction ath10k_wmi_tx_beacons_iterfunction ath10k_wmi_tx_beacons_nowaitfunction ath10k_wmi_op_ep_tx_creditsfunction ath10k_wmi_cmd_sendfunction wait_event_timeoutfunction ath10k_wmi_op_gen_mgmt_txfunction ath10k_wmi_event_scan_startedfunction ath10k_wmi_event_scan_start_failedfunction ath10k_wmi_event_scan_completedfunction ath10k_wmi_event_scan_bss_chanfunction ath10k_wmi_event_scan_foreign_chanfunction ath10k_wmi_event_scan_type_strfunction ath10k_wmi_op_pull_scan_evfunction ath10k_wmi_event_scanfunction ath10k_wmi_handle_wep_reauthfunction ath10k_wmi_op_pull_mgmt_rx_evfunction ath10k_wmi_10_4_op_pull_mgmt_rx_evfunction ath10k_wmi_rx_is_decryptedfunction wmi_process_mgmt_tx_compfunction ath10k_wmi_event_mgmt_tx_complfunction ath10k_wmi_event_mgmt_tx_bundle_complfunction ath10k_wmi_event_mgmt_rxfunction freq_to_idxfunction ath10k_wmi_op_pull_ch_info_evfunction ath10k_wmi_10_4_op_pull_ch_info_evfunction ath10k_wmi_event_chan_info_unpairedfunction pairsfunction ath10k_wmi_event_chan_infofunction ath10k_wmi_event_echofunction ath10k_wmi_event_debug_mesgfunction ath10k_wmi_pull_pdev_stats_basefunction ath10k_wmi_pull_pdev_stats_txfunction ath10k_wmi_10_4_pull_pdev_stats_txfunction ath10k_wmi_pull_pdev_stats_rxfunction ath10k_wmi_pull_pdev_stats_extrafunction ath10k_wmi_pull_peer_statsfunction ath10k_wmi_10_4_pull_peer_statsfunction ath10k_wmi_10_4_pull_vdev_statsfunction ath10k_wmi_main_op_pull_fw_statsfunction ath10k_wmi_10x_op_pull_fw_statsfunction ath10k_wmi_10_2_op_pull_fw_statsfunction ath10k_wmi_10_2_4_op_pull_fw_stats
Annotated Snippet
if (arg->freq > arg->band_center_freq1) {
band_center_freq1 = arg->band_center_freq1 + 40;
band_center_freq2 = arg->band_center_freq1 - 40;
} else {
band_center_freq1 = arg->band_center_freq1 - 40;
band_center_freq2 = arg->band_center_freq1 + 40;
}
ch->band_center_freq1 =
__cpu_to_le32(band_center_freq1);
/* Minus 10 to get a defined 5G channel frequency*/
chan = ieee80211_get_channel(ar->hw->wiphy,
band_center_freq2 - 10);
/* The center frequency of the entire VHT160 */
ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq1);
}
if (chan && chan->flags & IEEE80211_CHAN_RADAR)
flags |= WMI_CHAN_FLAG_DFS_CFREQ2;
ch->min_power = arg->min_power;
ch->max_power = arg->max_power;
ch->reg_power = arg->max_reg_power;
ch->antenna_max = arg->max_antenna_gain;
ch->max_tx_power = arg->max_power;
/* mode & flags share storage */
ch->mode = arg->mode;
ch->flags |= __cpu_to_le32(flags);
}
int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
{
unsigned long time_left, i;
time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
WMI_SERVICE_READY_TIMEOUT_HZ);
if (!time_left) {
/* Sometimes the PCI HIF doesn't receive interrupt
* for the service ready message even if the buffer
* was completed. PCIe sniffer shows that it's
* because the corresponding CE ring doesn't fires
* it. Workaround here by polling CE rings once.
*/
ath10k_warn(ar, "failed to receive service ready completion, polling..\n");
for (i = 0; i < CE_COUNT; i++)
ath10k_hif_send_complete_check(ar, i, 1);
time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
WMI_SERVICE_READY_TIMEOUT_HZ);
if (!time_left) {
ath10k_warn(ar, "polling timed out\n");
return -ETIMEDOUT;
}
ath10k_warn(ar, "service ready completion received, continuing normally\n");
}
return 0;
}
int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
{
unsigned long time_left;
time_left = wait_for_completion_timeout(&ar->wmi.unified_ready,
WMI_UNIFIED_READY_TIMEOUT_HZ);
if (!time_left)
return -ETIMEDOUT;
return 0;
}
struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)
{
struct sk_buff *skb;
u32 round_len = roundup(len, 4);
skb = ath10k_htc_alloc_skb(ar, WMI_SKB_HEADROOM + round_len);
if (!skb)
return NULL;
skb_reserve(skb, WMI_SKB_HEADROOM);
if (!IS_ALIGNED((unsigned long)skb->data, 4))
ath10k_warn(ar, "Unaligned WMI skb\n");
skb_put(skb, round_len);
memset(skb->data, 0, round_len);
return skb;
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/ctype.h`, `core.h`, `htc.h`, `debug.h`, `wmi.h`, `wmi-tlv.h`, `mac.h`.
- Detected declarations: `function ath10k_wmi_put_wmi_channel`, `function ath10k_wmi_wait_for_service_ready`, `function ath10k_wmi_wait_for_unified_ready`, `function ath10k_wmi_htc_tx_complete`, `function ath10k_wmi_cmd_send_nowait`, `function ath10k_wmi_tx_beacon_nowait`, `function ath10k_wmi_tx_beacons_iter`, `function ath10k_wmi_tx_beacons_nowait`, `function ath10k_wmi_op_ep_tx_credits`, `function ath10k_wmi_cmd_send`.
- 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.