drivers/net/wireless/ath/ath10k/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/mac.c- Extension
.c- Size
- 271831 bytes
- Lines
- 10381
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
mac.hlinux/export.hnet/cfg80211.hnet/mac80211.hlinux/etherdevice.hlinux/acpi.hlinux/of.hlinux/bitfield.hlinux/random.hhif.hcore.hdebug.hwmi.hhtt.htxrx.htestmode.hwmi-tlv.hwmi-ops.hwow.hleds.h
Detected Declarations
struct ath10k_mac_tx_pausestruct ath10k_mac_tdls_iter_datastruct ath10k_mac_iter_tid_conf_datastruct ath10k_mac_change_chanctx_argenum ath10k_mac_tx_pathfunction ath10k_mac_bitrate_is_cckfunction ath10k_mac_bitrate_to_ratefunction ath10k_mac_hw_rate_to_idxfunction ath10k_mac_bitrate_to_idxfunction ath10k_mac_get_rate_hw_valuefunction ath10k_mac_get_max_vht_mcs_mapfunction ath10k_mac_max_ht_nssfunction ath10k_mac_max_vht_nssfunction ath10k_mac_ext_resource_configfunction ath10k_send_keyfunction ath10k_install_keyfunction ath10k_install_peer_wep_keysfunction ath10k_clear_peer_keysfunction ath10k_mac_is_peer_wep_key_setfunction ath10k_clear_vdev_keyfunction list_for_each_entryfunction ath10k_mac_vif_update_wep_keyfunction list_for_each_entryfunction chan_to_phymodefunction ath10k_parse_mpdudensityfunction ath10k_mac_vif_chanfunction ath10k_mac_num_chanctxs_iterfunction ath10k_mac_num_chanctxsfunction ath10k_mac_get_any_chandef_iterfunction ath10k_wait_for_peer_delete_donefunction ath10k_peer_createfunction ath10k_mac_set_kickoutfunction ath10k_mac_set_rtsfunction ath10k_peer_deletefunction ath10k_peer_map_cleanupfunction for_each_set_bitfunction ath10k_peer_cleanupfunction ath10k_peer_cleanup_allfunction ath10k_mac_tdls_peer_updatefunction ath10k_mac_vif_beacon_freefunction ath10k_mac_vif_beacon_cleanupfunction ath10k_vdev_setup_syncfunction ath10k_vdev_delete_syncfunction ath10k_monitor_vdev_startfunction ath10k_monitor_vdev_stopfunction ath10k_monitor_vdev_createfunction ath10k_monitor_vdev_deletefunction ath10k_monitor_start
Annotated Snippet
struct ath10k_mac_tx_pause {
u32 vdev_id;
enum wmi_tlv_tx_pause_id pause_id;
enum wmi_tlv_tx_pause_action action;
};
static void ath10k_mac_handle_tx_pause_iter(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct ath10k_vif *arvif = (void *)vif->drv_priv;
struct ath10k_mac_tx_pause *arg = data;
if (arvif->vdev_id != arg->vdev_id)
return;
ath10k_mac_vif_handle_tx_pause(arvif, arg->pause_id, arg->action);
}
void ath10k_mac_handle_tx_pause_vdev(struct ath10k *ar, u32 vdev_id,
enum wmi_tlv_tx_pause_id pause_id,
enum wmi_tlv_tx_pause_action action)
{
struct ath10k_mac_tx_pause arg = {
.vdev_id = vdev_id,
.pause_id = pause_id,
.action = action,
};
spin_lock_bh(&ar->htt.tx_lock);
ieee80211_iterate_active_interfaces_atomic(ar->hw,
ATH10K_ITER_RESUME_FLAGS,
ath10k_mac_handle_tx_pause_iter,
&arg);
spin_unlock_bh(&ar->htt.tx_lock);
}
static enum ath10k_hw_txrx_mode
ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{
const struct ieee80211_hdr *hdr = (void *)skb->data;
const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
__le16 fc = hdr->frame_control;
if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)
return ATH10K_HW_TXRX_ETHERNET;
if (!vif || vif->type == NL80211_IFTYPE_MONITOR)
return ATH10K_HW_TXRX_RAW;
if (ieee80211_is_mgmt(fc))
return ATH10K_HW_TXRX_MGMT;
/* Workaround:
*
* NullFunc frames are mostly used to ping if a client or AP are still
* reachable and responsive. This implies tx status reports must be
* accurate - otherwise either mac80211 or userspace (e.g. hostapd) can
* come to a conclusion that the other end disappeared and tear down
* BSS connection or it can never disconnect from BSS/client (which is
* the case).
*
* Firmware with HTT older than 3.0 delivers incorrect tx status for
* NullFunc frames to driver. However there's a HTT Mgmt Tx command
* which seems to deliver correct tx reports for NullFunc frames. The
* downside of using it is it ignores client powersave state so it can
* end up disconnecting sleeping clients in AP mode. It should fix STA
* mode though because AP don't sleep.
*/
if (ar->htt.target_version_major < 3 &&
(ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
!test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
ar->running_fw->fw_file.fw_features))
return ATH10K_HW_TXRX_MGMT;
/* Workaround:
*
* Some wmi-tlv firmwares for qca6174 have broken Tx key selection for
* NativeWifi txmode - it selects AP key instead of peer key. It seems
* to work with Ethernet txmode so use it.
*
* FIXME: Check if raw mode works with TDLS.
*/
if (ieee80211_is_data_present(fc) && sta && sta->tdls)
return ATH10K_HW_TXRX_ETHERNET;
if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) ||
skb_cb->flags & ATH10K_SKB_F_RAW_TX)
Annotation
- Immediate include surface: `mac.h`, `linux/export.h`, `net/cfg80211.h`, `net/mac80211.h`, `linux/etherdevice.h`, `linux/acpi.h`, `linux/of.h`, `linux/bitfield.h`.
- Detected declarations: `struct ath10k_mac_tx_pause`, `struct ath10k_mac_tdls_iter_data`, `struct ath10k_mac_iter_tid_conf_data`, `struct ath10k_mac_change_chanctx_arg`, `enum ath10k_mac_tx_path`, `function ath10k_mac_bitrate_is_cck`, `function ath10k_mac_bitrate_to_rate`, `function ath10k_mac_hw_rate_to_idx`, `function ath10k_mac_bitrate_to_idx`, `function ath10k_mac_get_rate_hw_value`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.