drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c- Extension
.c- Size
- 58029 bytes
- Lines
- 1929
- 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
linux/etherdevice.hlinux/crc32.hnet/mac80211.hiwl-io.hiwl-prph.hfw-api.hmvm.htime-event.hiwl-utils.h
Detected Declarations
struct iwl_mvm_mac_iface_iterator_datastruct iwl_mvm_go_iterator_datastruct iwl_mvm_mac_ap_iterator_datafunction iwl_mvm_mac_tsf_id_iterfunction iwl_mvm_mac_iface_iteratorfunction iwl_mvm_mac_ctxt_recalc_tsf_idfunction iwl_mvm_mac_ctxt_initfunction iwl_mvm_ack_ratesfunction for_each_set_bitfunction iwl_mvm_set_fw_basic_ratesfunction iwl_mvm_set_fw_protection_flagsfunction iwl_mvm_set_fw_qos_paramsfunction iwl_mvm_get_mac_typefunction iwl_mvm_mac_ctxt_cmd_commonfunction iwl_mvm_mac_ctxt_send_cmdfunction iwl_mvm_set_fw_dtim_tbttfunction iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwinfunction iwl_mvm_mac_ctxt_cmd_sta_get_twt_policyfunction iwl_mvm_mac_ctxt_cmd_stafunction iwl_mvm_mac_ctxt_cmd_listenerfunction iwl_mvm_mac_ctxt_cmd_ibssfunction iwl_mvm_go_iteratorfunction iwl_mac_ctxt_p2p_dev_has_extended_discfunction iwl_mvm_mac_ctxt_cmd_p2p_devicefunction iwl_mvm_mac_ctxt_set_timfunction iwl_mvm_mac_ctxt_get_lowest_ratefunction iwl_mvm_mac_ctxt_get_beacon_flagsfunction iwl_mvm_mac_ctxt_get_beacon_ratefunction iwl_mvm_mac_ctxt_set_txfunction iwl_mvm_mac_ctxt_send_beacon_cmdfunction iwl_mvm_mac_ctxt_send_beacon_v6function iwl_mvm_mac_ctxt_send_beacon_v7function iwl_mvm_enable_filsfunction iwl_mvm_mac_ctxt_send_beacon_v9function iwl_mvm_mac_ctxt_send_beaconfunction iwl_mvm_mac_ctxt_beacon_changedfunction iwl_mvm_mac_ap_iteratorfunction iwl_mvm_mac_ctxt_cmd_ap_set_filter_flagsfunction iwl_mvm_mac_ctxt_cmd_fill_apfunction iwl_mvm_mac_ctxt_cmd_apfunction iwl_mvm_mac_ctxt_cmd_gofunction iwl_mvm_mac_ctx_sendfunction iwl_mvm_mac_ctxt_addfunction iwl_mvm_mac_ctxt_changedfunction iwl_mvm_mac_ctxt_removefunction iwl_mvm_csa_count_downfunction iwl_mvm_rx_beacon_notiffunction iwl_mvm_handle_missed_beacons_notif
Annotated Snippet
struct iwl_mvm_mac_iface_iterator_data {
struct iwl_mvm *mvm;
struct ieee80211_vif *vif;
unsigned long available_mac_ids[BITS_TO_LONGS(NUM_MAC_INDEX_DRIVER)];
unsigned long available_tsf_ids[BITS_TO_LONGS(NUM_TSF_IDS)];
enum iwl_tsf_id preferred_tsf;
bool found_vif;
};
static void iwl_mvm_mac_tsf_id_iter(void *_data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mvm_mac_iface_iterator_data *data = _data;
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
u16 min_bi;
/* Skip the interface for which we are trying to assign a tsf_id */
if (vif == data->vif)
return;
/*
* The TSF is a hardware/firmware resource, there are 4 and
* the driver should assign and free them as needed. However,
* there are cases where 2 MACs should share the same TSF ID
* for the purpose of clock sync, an optimization to avoid
* clock drift causing overlapping TBTTs/DTIMs for a GO and
* client in the system.
*
* The firmware will decide according to the MAC type which
* will be the leader and follower. Clients that need to sync
* with a remote station will be the leader, and an AP or GO
* will be the follower.
*
* Depending on the new interface type it can be following
* or become the leader of an existing interface.
*/
switch (data->vif->type) {
case NL80211_IFTYPE_STATION:
/*
* The new interface is a client, so if the one we're iterating
* is an AP, and the beacon interval of the AP is a multiple or
* divisor of the beacon interval of the client, the same TSF
* should be used to avoid drift between the new client and
* existing AP. The existing AP will get drift updates from the
* new client context in this case.
*/
if (vif->type != NL80211_IFTYPE_AP ||
data->preferred_tsf != NUM_TSF_IDS ||
!test_bit(mvmvif->tsf_id, data->available_tsf_ids))
break;
min_bi = min(data->vif->bss_conf.beacon_int,
vif->bss_conf.beacon_int);
if (!min_bi)
break;
if ((data->vif->bss_conf.beacon_int -
vif->bss_conf.beacon_int) % min_bi == 0) {
data->preferred_tsf = mvmvif->tsf_id;
return;
}
break;
case NL80211_IFTYPE_AP:
/*
* The new interface is AP/GO, so if its beacon interval is a
* multiple or a divisor of the beacon interval of an existing
* interface, it should get drift updates from an existing
* client or use the same TSF as an existing GO. There's no
* drift between TSFs internally but if they used different
* TSFs then a new client MAC could update one of them and
* cause drift that way.
*/
if ((vif->type != NL80211_IFTYPE_AP &&
vif->type != NL80211_IFTYPE_STATION) ||
data->preferred_tsf != NUM_TSF_IDS ||
!test_bit(mvmvif->tsf_id, data->available_tsf_ids))
break;
min_bi = min(data->vif->bss_conf.beacon_int,
vif->bss_conf.beacon_int);
if (!min_bi)
break;
if ((data->vif->bss_conf.beacon_int -
vif->bss_conf.beacon_int) % min_bi == 0) {
data->preferred_tsf = mvmvif->tsf_id;
return;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/crc32.h`, `net/mac80211.h`, `iwl-io.h`, `iwl-prph.h`, `fw-api.h`, `mvm.h`, `time-event.h`.
- Detected declarations: `struct iwl_mvm_mac_iface_iterator_data`, `struct iwl_mvm_go_iterator_data`, `struct iwl_mvm_mac_ap_iterator_data`, `function iwl_mvm_mac_tsf_id_iter`, `function iwl_mvm_mac_iface_iterator`, `function iwl_mvm_mac_ctxt_recalc_tsf_id`, `function iwl_mvm_mac_ctxt_init`, `function iwl_mvm_ack_rates`, `function for_each_set_bit`, `function iwl_mvm_set_fw_basic_rates`.
- 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.