drivers/net/wireless/mediatek/mt76/mt7915/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7915/mac.c- Extension
.c- Size
- 62869 bytes
- Lines
- 2390
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/etherdevice.hlinux/timekeeping.hcoredump.hmt7915.h../dma.hmac.hmcu.h
Detected Declarations
function mt7915_mac_wtbl_updatefunction mt7915_mac_wtbl_lmac_addrfunction mt7915_mac_sta_pollfunction mt7915_wed_check_ppefunction mt7915_mac_fill_rxfunction mt7915_mac_fill_rx_vectorfunction mt7915_mac_write_txwi_tmfunction mt7915_mac_write_txwifunction mt7915_tx_prepare_skbfunction mt7915_wed_init_buffunction mt7915_mac_tx_free_preparefunction mt7915_mac_tx_free_donefunction list_for_each_entry_safefunction mt7915_mac_tx_freefunction mt7915_mac_tx_free_v0function mt7915_mac_add_txsfunction mt7915_rx_checkfunction mt7915_queue_rx_skbfunction mt7915_mac_cca_stats_resetfunction mt7915_mac_reset_countersfunction mt7915_mac_set_timingfunction mt7915_mac_enable_nffunction mt7915_phy_get_nffunction mt7915_update_channelfunction mt7915_wait_reset_statefunction mt7915_update_vif_beaconfunction mt7915_update_beaconsfunction mt7915_mac_restartfunction mt76_for_each_q_rxfunction mt7915_mac_full_resetfunction mt7915_mac_reset_workfunction mt76_for_each_q_rxfunction mt7915_mac_dump_workfunction mt7915_resetfunction mt7915_mac_update_statsfunction mt7915_mac_severe_checkfunction mt7915_mac_sta_rc_workfunction mt7915_mac_workfunction mt7915_dfs_stop_radar_detectorfunction mt7915_dfs_start_rddfunction mt7915_dfs_start_radar_detectorfunction mt7915_dfs_init_radar_specsfunction mt7915_dfs_init_radar_detectorfunction mt7915_mac_twt_duration_alignfunction mt7915_mac_twt_sched_list_addfunction list_for_each_entry_safefunction mt7915_mac_check_twt_reqfunction mt7915_mac_twt_param_equal
Annotated Snippet
if (list_empty(&sta_poll_list)) {
spin_unlock_bh(&dev->mt76.sta_poll_lock);
break;
}
msta = list_first_entry(&sta_poll_list,
struct mt7915_sta, wcid.poll_list);
list_del_init(&msta->wcid.poll_list);
spin_unlock_bh(&dev->mt76.sta_poll_lock);
idx = msta->wcid.idx;
/* refresh peer's airtime reporting */
addr = mt7915_mac_wtbl_lmac_addr(dev, idx, 20);
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
u32 tx_last = msta->airtime_ac[i];
u32 rx_last = msta->airtime_ac[i + 4];
msta->airtime_ac[i] = mt76_rr(dev, addr);
msta->airtime_ac[i + 4] = mt76_rr(dev, addr + 4);
if (msta->airtime_ac[i] <= tx_last)
tx_time[i] = 0;
else
tx_time[i] = msta->airtime_ac[i] - tx_last;
if (msta->airtime_ac[i + 4] <= rx_last)
rx_time[i] = 0;
else
rx_time[i] = msta->airtime_ac[i + 4] - rx_last;
if ((tx_last | rx_last) & BIT(30))
clear = true;
addr += 8;
}
if (clear) {
mt7915_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac));
}
if (!msta->wcid.sta)
continue;
sta = container_of((void *)msta, struct ieee80211_sta,
drv_priv);
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
u8 queue = mt76_connac_lmac_mapping(i);
u32 tx_cur = tx_time[queue];
u32 rx_cur = rx_time[queue];
u8 tid = ac_to_tid[i];
if (!tx_cur && !rx_cur)
continue;
ieee80211_sta_register_airtime(sta, tid, tx_cur,
rx_cur);
}
/*
* We don't support reading GI info from txs packets.
* For accurate tx status reporting and AQL improvement,
* we need to make sure that flags match so polling GI
* from per-sta counters directly.
*/
rate = &msta->wcid.rate;
addr = mt7915_mac_wtbl_lmac_addr(dev, idx, 7);
val = mt76_rr(dev, addr);
switch (rate->bw) {
case RATE_INFO_BW_160:
bw = IEEE80211_STA_RX_BW_160;
break;
case RATE_INFO_BW_80:
bw = IEEE80211_STA_RX_BW_80;
break;
case RATE_INFO_BW_40:
bw = IEEE80211_STA_RX_BW_40;
break;
default:
bw = IEEE80211_STA_RX_BW_20;
break;
}
if (rate->flags & RATE_INFO_FLAGS_HE_MCS) {
u8 offs = 24 + 2 * bw;
rate->he_gi = (val & (0x3 << offs)) >> offs;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/timekeeping.h`, `coredump.h`, `mt7915.h`, `../dma.h`, `mac.h`, `mcu.h`.
- Detected declarations: `function mt7915_mac_wtbl_update`, `function mt7915_mac_wtbl_lmac_addr`, `function mt7915_mac_sta_poll`, `function mt7915_wed_check_ppe`, `function mt7915_mac_fill_rx`, `function mt7915_mac_fill_rx_vector`, `function mt7915_mac_write_txwi_tm`, `function mt7915_mac_write_txwi`, `function mt7915_tx_prepare_skb`, `function mt7915_wed_init_buf`.
- 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.