drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c- Extension
.c- Size
- 14094 bytes
- Lines
- 567
- 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.
- 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
linux/kernel.hlinux/irq.hmt76x02.hmt76x02_mcu.htrace.h
Detected Declarations
function Copyrightfunction mt76x02e_pre_tbtt_enablefunction mt76x02e_beacon_enablefunction mt76x02e_init_beacon_configfunction mt76x02_init_rx_queuefunction mt76x02_process_tx_status_fifofunction mt76x02_tx_workerfunction mt76x02_poll_txfunction mt76x02_dma_initfunction mt76x02_rx_poll_completefunction mt76x02_irq_handlerfunction mt76x02_dma_enablefunction mt76x02_dma_disablefunction mt76x02_mac_startfunction mt76x02_tx_hangfunction mt76x02_key_syncfunction mt76x02_reset_statefunction mt76x02_watchdog_resetfunction mt76_for_each_q_rxfunction mt76_for_each_q_rxfunction mt76x02_reconfig_completefunction mt76x02_check_tx_hangfunction mt76x02_wdt_workexport mt76x02e_init_beacon_configexport mt76x02_dma_initexport mt76x02_rx_poll_completeexport mt76x02_irq_handlerexport mt76x02_dma_disableexport mt76x02_mac_startexport mt76x02_reconfig_complete
Annotated Snippet
if (!q->queued || prev_dma_idx != dma_idx) {
dev->tx_hang_check[i] = 0;
continue;
}
if (++dev->tx_hang_check[i] >= MT_TX_HANG_TH)
return true;
}
return false;
}
static void mt76x02_key_sync(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key, void *data)
{
struct mt76x02_dev *dev = hw->priv;
struct mt76_wcid *wcid;
if (!sta)
return;
wcid = (struct mt76_wcid *)sta->drv_priv;
if (wcid->hw_key_idx != key->keyidx || wcid->sw_iv)
return;
mt76x02_mac_wcid_sync_pn(dev, wcid->idx, key);
}
static void mt76x02_reset_state(struct mt76x02_dev *dev)
{
int i;
lockdep_assert_held(&dev->mt76.mutex);
clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
rcu_read_lock();
ieee80211_iter_keys_rcu(dev->mt76.hw, NULL, mt76x02_key_sync, NULL);
rcu_read_unlock();
for (i = 0; i < MT76x02_N_WCIDS; i++) {
struct ieee80211_sta *sta;
struct ieee80211_vif *vif;
struct mt76x02_sta *msta;
struct mt76_wcid *wcid;
void *priv;
wcid = rcu_dereference_protected(dev->mt76.wcid[i],
lockdep_is_held(&dev->mt76.mutex));
if (!wcid)
continue;
rcu_assign_pointer(dev->mt76.wcid[i], NULL);
priv = msta = container_of(wcid, struct mt76x02_sta, wcid);
sta = container_of(priv, struct ieee80211_sta, drv_priv);
priv = msta->vif;
vif = container_of(priv, struct ieee80211_vif, drv_priv);
__mt76_sta_remove(&dev->mphy, vif, sta);
memset(msta, 0, sizeof(*msta));
}
dev->mt76.vif_mask = 0;
dev->mt76.beacon_mask = 0;
}
static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
{
u32 mask = dev->mt76.mmio.irqmask;
bool restart = dev->mt76.mcu_ops->mcu_restart;
int i;
ieee80211_stop_queues(dev->mt76.hw);
set_bit(MT76_RESET, &dev->mphy.state);
tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt76_worker_disable(&dev->mt76.tx_worker);
napi_disable(&dev->mt76.tx_napi);
mt76_for_each_q_rx(&dev->mt76, i) {
napi_disable(&dev->mt76.napi[i]);
}
mutex_lock(&dev->mt76.mutex);
dev->mcu_timeout = 0;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/irq.h`, `mt76x02.h`, `mt76x02_mcu.h`, `trace.h`.
- Detected declarations: `function Copyright`, `function mt76x02e_pre_tbtt_enable`, `function mt76x02e_beacon_enable`, `function mt76x02e_init_beacon_config`, `function mt76x02_init_rx_queue`, `function mt76x02_process_tx_status_fifo`, `function mt76x02_tx_worker`, `function mt76x02_poll_tx`, `function mt76x02_dma_init`, `function mt76x02_rx_poll_complete`.
- 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.
- 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.