drivers/net/wireless/ath/ath11k/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/mac.c- Extension
.c- Size
- 296291 bytes
- Lines
- 10879
- 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
net/mac80211.hnet/cfg80211.hlinux/etherdevice.hlinux/bitfield.hlinux/inetdevice.hnet/if_inet6.hnet/ipv6.hmac.hcore.hdebug.hwmi.hhw.hdp_tx.hdp_rx.htestmode.hpeer.hdebugfs_sta.hhif.hwow.h
Detected Declarations
struct ath11k_mac_change_chanctx_argfunction Copyrightfunction ath11k_mac_phy_he_ru_to_nl80211_he_ru_allocfunction ath11k_mac_he_ru_tones_to_nl80211_he_ru_allocfunction ath11k_mac_he_gi_to_nl80211_he_gifunction ath11k_mac_bw_to_mac80211_bwfunction ath11k_mac_mac80211_bw_to_ath11k_bwfunction ath11k_mac_hw_ratecode_to_legacy_ratefunction get_num_chainsfunction ath11k_mac_bitrate_to_idxfunction ath11k_mac_max_ht_nssfunction ath11k_mac_max_vht_nssfunction ath11k_mac_max_he_nssfunction ath11k_parse_mpdudensityfunction ath11k_mac_vif_chanfunction ath11k_mac_bitrate_is_cckfunction ath11k_mac_hw_rate_to_idxfunction ath11k_mac_bitrate_to_ratefunction ath11k_get_arvif_iterfunction list_for_each_entryfunction ath11k_mac_band_matchfunction ath11k_mac_get_target_pdev_id_from_viffunction ath11k_mac_get_target_pdev_idfunction ath11k_pdev_caps_updatefunction ath11k_mac_txpower_recalcfunction list_for_each_entryfunction ath11k_recalc_rtscts_protfunction ath11k_mac_set_kickoutfunction ath11k_mac_peer_cleanup_allfunction ath11k_mac_vdev_setup_syncfunction ath11k_mac_get_any_chandef_iterfunction ath11k_mac_monitor_vdev_startfunction ath11k_mac_monitor_vdev_stopfunction ath11k_mac_monitor_vdev_createfunction ath11k_mac_monitor_vdev_deletefunction ath11k_mac_monitor_startfunction ath11k_mac_monitor_stopfunction ath11k_mac_vif_setup_psfunction ath11k_mac_config_psfunction list_for_each_entryfunction ath11k_mac_op_configfunction ath11k_mac_setup_nontx_vif_rsniefunction ath11k_mac_set_nontx_vif_paramsfunction ath11k_mac_setup_bcn_p2p_iefunction ath11k_mac_remove_vendor_iefunction ath11k_mac_set_vif_paramsfunction ath11k_mac_setup_bcn_tmpl_emafunction ath11k_mac_setup_bcn_tmpl_mbssid
Annotated Snippet
struct ath11k_mac_change_chanctx_arg {
struct ieee80211_chanctx_conf *ctx;
struct ieee80211_vif_chanctx_switch *vifs;
int n_vifs;
int next_vif;
};
static void
ath11k_mac_change_chanctx_cnt_iter(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct ath11k_mac_change_chanctx_arg *arg = data;
if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx)
return;
arg->n_vifs++;
}
static void
ath11k_mac_change_chanctx_fill_iter(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct ath11k_mac_change_chanctx_arg *arg = data;
struct ieee80211_chanctx_conf *ctx;
ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf);
if (ctx != arg->ctx)
return;
if (WARN_ON(arg->next_vif == arg->n_vifs))
return;
arg->vifs[arg->next_vif].vif = vif;
arg->vifs[arg->next_vif].old_ctx = ctx;
arg->vifs[arg->next_vif].new_ctx = ctx;
arg->next_vif++;
}
static void
ath11k_mac_update_vif_chan(struct ath11k *ar,
struct ieee80211_vif_chanctx_switch *vifs,
int n_vifs)
{
struct ath11k_base *ab = ar->ab;
struct ath11k_vif *arvif, *tx_arvif;
int ret;
int i;
bool monitor_vif = false;
lockdep_assert_held(&ar->conf_mutex);
/* Associated channel resources of all relevant vdevs
* should be available for the channel switch now.
*/
/* TODO: Update ar->rx_channel */
for (i = 0; i < n_vifs; i++) {
arvif = ath11k_vif_to_arvif(vifs[i].vif);
if (WARN_ON(!arvif->is_started))
continue;
/* change_chanctx can be called even before vdev_up from
* ieee80211_start_ap->ieee80211_vif_use_channel->
* ieee80211_recalc_radar_chanctx.
*
* Firmware expect vdev_restart only if vdev is up.
* If vdev is down then it expect vdev_stop->vdev_start.
*/
if (arvif->is_up) {
ret = ath11k_mac_vdev_restart(arvif, vifs[i].new_ctx);
if (ret) {
ath11k_warn(ab, "failed to restart vdev %d: %d\n",
arvif->vdev_id, ret);
continue;
}
} else {
ret = ath11k_mac_vdev_stop(arvif);
if (ret) {
ath11k_warn(ab, "failed to stop vdev %d: %d\n",
arvif->vdev_id, ret);
continue;
}
ret = ath11k_mac_vdev_start(arvif, vifs[i].new_ctx);
if (ret)
ath11k_warn(ab, "failed to start vdev %d: %d\n",
arvif->vdev_id, ret);
Annotation
- Immediate include surface: `net/mac80211.h`, `net/cfg80211.h`, `linux/etherdevice.h`, `linux/bitfield.h`, `linux/inetdevice.h`, `net/if_inet6.h`, `net/ipv6.h`, `mac.h`.
- Detected declarations: `struct ath11k_mac_change_chanctx_arg`, `function Copyright`, `function ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc`, `function ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc`, `function ath11k_mac_he_gi_to_nl80211_he_gi`, `function ath11k_mac_bw_to_mac80211_bw`, `function ath11k_mac_mac80211_bw_to_ath11k_bw`, `function ath11k_mac_hw_ratecode_to_legacy_rate`, `function get_num_chains`, `function ath11k_mac_bitrate_to_idx`.
- 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.