drivers/net/wireless/mediatek/mt76/mt7925/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7925/mac.c- Extension
.c- Size
- 39579 bytes
- Lines
- 1514
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/devcoredump.hlinux/etherdevice.hlinux/timekeeping.hmt7925.h../dma.hregd.hmac.hmcu.h
Detected Declarations
function mt7925_mac_wtbl_updatefunction mt7925_mac_sta_pollfunction mt7925_mac_set_fixed_rate_tablefunction mt7925_reverse_frag0_hdr_transfunction mt7925_mac_fill_rx_ratefunction mt7925_mac_fill_rxfunction mt7925_mac_write_txwi_8023function mt7925_mac_write_txwi_80211function mt7925_mac_write_txwifunction mt7925_tx_check_aggrfunction mt7925_mac_add_txs_skbfunction mt7925_mac_add_txsfunction mt7925_txwi_freefunction mt7925_mac_tx_freefunction list_for_each_entry_safefunction mt7925_rx_checkfunction mt7925_queue_rx_skbfunction mt7925_vif_connect_iterfunction for_each_set_bitfunction mt7925_mac_reset_workfunction mt7925_coredump_workfunction mt7925_usb_sdio_write_txwifunction mt7925_usb_sdio_tx_prepare_skbfunction mt7925_usb_sdio_tx_complete_skbfunction mt7925_usb_sdio_tx_status_datafunction mt7925_set_ipv6_ns_workexport mt7925_mac_write_txwiexport mt7925_txwi_freeexport mt7925_rx_checkexport mt7925_queue_rx_skbexport mt7925_usb_sdio_tx_prepare_skbexport mt7925_usb_sdio_tx_complete_skbexport mt7925_usb_sdio_tx_status_data
Annotated Snippet
if (clear) {
mt7925_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac));
}
if (!mlink->wcid.sta)
continue;
sta = container_of((void *)msta, struct ieee80211_sta,
drv_priv);
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
u8 q = mt76_connac_lmac_mapping(i);
u32 tx_cur = tx_time[q];
u32 rx_cur = rx_time[q];
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 = &mlink->wcid.rate;
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;
}
addr = mt7925_mac_wtbl_lmac_addr(dev, idx, 6);
val = mt76_rr(dev, addr);
if (rate->flags & RATE_INFO_FLAGS_EHT_MCS) {
addr = mt7925_mac_wtbl_lmac_addr(dev, idx, 5);
val = mt76_rr(dev, addr);
rate->eht_gi = FIELD_GET(GENMASK(25, 24), val);
} else if (rate->flags & RATE_INFO_FLAGS_HE_MCS) {
u8 offs = MT_WTBL_TXRX_RATE_G2_HE + 2 * bw;
rate->he_gi = (val & (0x3 << offs)) >> offs;
} else if (rate->flags &
(RATE_INFO_FLAGS_VHT_MCS | RATE_INFO_FLAGS_MCS)) {
if (val & BIT(MT_WTBL_TXRX_RATE_G2 + bw))
rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
else
rate->flags &= ~RATE_INFO_FLAGS_SHORT_GI;
}
/* get signal strength of resp frames (CTS/BA/ACK) */
addr = mt7925_mac_wtbl_lmac_addr(dev, idx, 34);
val = mt76_rr(dev, addr);
rssi[0] = to_rssi(GENMASK(7, 0), val);
rssi[1] = to_rssi(GENMASK(15, 8), val);
rssi[2] = to_rssi(GENMASK(23, 16), val);
rssi[3] = to_rssi(GENMASK(31, 14), val);
mlink->ack_signal =
mt76_rx_signal(msta->vif->phy->mt76->antenna_mask, rssi);
ewma_avg_signal_add(&mlink->avg_ack_signal, -mlink->ack_signal);
}
}
void mt7925_mac_set_fixed_rate_table(struct mt792x_dev *dev,
u8 tbl_idx, u16 rate_idx)
{
u32 ctrl = MT_WTBL_ITCR_WR | MT_WTBL_ITCR_EXEC | tbl_idx;
mt76_wr(dev, MT_WTBL_ITDR0, rate_idx);
/* use wtbl spe idx */
mt76_wr(dev, MT_WTBL_ITDR1, MT_WTBL_SPE_IDX_SEL);
mt76_wr(dev, MT_WTBL_ITCR, ctrl);
}
Annotation
- Immediate include surface: `linux/devcoredump.h`, `linux/etherdevice.h`, `linux/timekeeping.h`, `mt7925.h`, `../dma.h`, `regd.h`, `mac.h`, `mcu.h`.
- Detected declarations: `function mt7925_mac_wtbl_update`, `function mt7925_mac_sta_poll`, `function mt7925_mac_set_fixed_rate_table`, `function mt7925_reverse_frag0_hdr_trans`, `function mt7925_mac_fill_rx_rate`, `function mt7925_mac_fill_rx`, `function mt7925_mac_write_txwi_8023`, `function mt7925_mac_write_txwi_80211`, `function mt7925_mac_write_txwi`, `function mt7925_tx_check_aggr`.
- 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.
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.