drivers/net/wireless/mediatek/mt76/mt7603/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7603/mac.c- Extension
.c- Size
- 47177 bytes
- Lines
- 1886
- 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.hmt7603.hmac.h../trace.h
Detected Declarations
function mt7603_ac_queue_mask0function mt76_stop_tx_acfunction mt76_start_tx_acfunction mt7603_mac_reset_countersfunction mt7603_mac_set_timingfunction mt7603_wtbl_updatefunction mt7603_wtbl1_addrfunction mt7603_wtbl2_addrfunction mt7603_wtbl3_addrfunction mt7603_wtbl4_addrfunction mt7603_wtbl_initfunction mt7603_wtbl_set_skip_txfunction mt7603_filter_txfunction mt7603_wtbl_set_smpsfunction mt7603_wtbl_set_psfunction mt7603_wtbl_clearfunction mt7603_wtbl_update_capfunction mt7603_mac_rx_ba_resetfunction mt7603_mac_tx_ba_resetfunction mt7603_mac_sta_pollfunction mt7603_rx_get_wcidfunction mt7603_mac_fill_rxfunction mt7603_mac_tx_rate_valfunction mt7603_wtbl_set_ratesfunction mt7603_mac_get_key_infofunction mt7603_wtbl_set_keyfunction mt7603_mac_write_txwifunction mt7603_tx_prepare_skbfunction mt7603_fill_txsfunction mt7603_mac_add_txs_skbfunction mt7603_mac_add_txsfunction mt7603_tx_complete_skbfunction wait_for_wpdmafunction mt7603_pse_resetfunction mt7603_mac_dma_startfunction mt7603_mac_startfunction mt7603_mac_stopfunction mt7603_pse_client_resetfunction mt7603_dma_sched_resetfunction mt7603_mac_watchdog_resetfunction mt76_for_each_q_rxfunction mt7603_dma_debugfunction mt7603_rx_fifo_busyfunction mt7603_rx_dma_busyfunction mt7603_tx_dma_busyfunction mt7603_tx_hangfunction mt7603_rx_pse_busyfunction mt7603_watchdog_check
Annotated Snippet
if (list_empty(&dev->mt76.sta_poll_list)) {
spin_unlock_bh(&dev->mt76.sta_poll_lock);
break;
}
msta = list_first_entry(&dev->mt76.sta_poll_list,
struct mt7603_sta, wcid.poll_list);
list_del_init(&msta->wcid.poll_list);
spin_unlock_bh(&dev->mt76.sta_poll_lock);
addr = mt7603_wtbl4_addr(msta->wcid.idx);
for (i = 0; i < 4; i++) {
u32 airtime_last = msta->tx_airtime_ac[i];
msta->tx_airtime_ac[i] = mt76_rr(dev, addr + i * 8);
airtime[i] = msta->tx_airtime_ac[i] - airtime_last;
airtime[i] *= 32;
total_airtime += airtime[i];
if (msta->tx_airtime_ac[i] & BIT(22))
clear = true;
}
if (clear) {
mt7603_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
memset(msta->tx_airtime_ac, 0,
sizeof(msta->tx_airtime_ac));
}
if (!msta->wcid.sta)
continue;
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
for (i = 0; i < 4; i++) {
struct mt76_queue *q = dev->mphy.q_tx[i];
u8 qidx = q->hw_idx;
u8 tid = ac_to_tid[i];
u32 txtime = airtime[qidx];
if (!txtime)
continue;
ieee80211_sta_register_airtime(sta, tid, txtime, 0);
}
}
rcu_read_unlock();
if (!total_airtime)
return;
spin_lock_bh(&dev->mt76.cc_lock);
dev->mphy.chan_state->cc_tx += total_airtime;
spin_unlock_bh(&dev->mt76.cc_lock);
}
static struct mt76_wcid *
mt7603_rx_get_wcid(struct mt7603_dev *dev, u8 idx, bool unicast)
{
struct mt7603_sta *sta;
struct mt76_wcid *wcid;
wcid = mt76_wcid_ptr(dev, idx);
if (unicast || !wcid)
return wcid;
if (!wcid->sta)
return NULL;
sta = container_of(wcid, struct mt7603_sta, wcid);
if (!sta->vif)
return NULL;
return &sta->vif->sta.wcid;
}
int
mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)
{
struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
struct ieee80211_supported_band *sband;
struct ieee80211_hdr *hdr;
__le32 *rxd = (__le32 *)skb->data;
u32 rxd0 = le32_to_cpu(rxd[0]);
u32 rxd1 = le32_to_cpu(rxd[1]);
u32 rxd2 = le32_to_cpu(rxd[2]);
bool unicast = rxd1 & MT_RXD1_NORMAL_U2M;
bool insert_ccmp_hdr = false;
bool remove_pad;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/timekeeping.h`, `mt7603.h`, `mac.h`, `../trace.h`.
- Detected declarations: `function mt7603_ac_queue_mask0`, `function mt76_stop_tx_ac`, `function mt76_start_tx_ac`, `function mt7603_mac_reset_counters`, `function mt7603_mac_set_timing`, `function mt7603_wtbl_update`, `function mt7603_wtbl1_addr`, `function mt7603_wtbl2_addr`, `function mt7603_wtbl3_addr`, `function mt7603_wtbl4_addr`.
- 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.