drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ralink/rt2x00/rt2800mmio.c- Extension
.c- Size
- 25421 bytes
- Lines
- 860
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/export.hrt2x00.hrt2x00mmio.hrt2800.hrt2800lib.hrt2800mmio.h
Detected Declarations
function Copyrightfunction rt2800mmio_write_tx_descfunction rt2800mmio_fill_rxdonefunction rt2800mmio_wakeupfunction rt2800mmio_enable_interruptfunction rt2800mmio_pretbtt_taskletfunction rt2800mmio_tbtt_taskletfunction rt2800mmio_rxdone_taskletfunction rt2800mmio_autowake_taskletfunction rt2800mmio_fetch_txstatusfunction rt2800mmio_txstatus_taskletfunction rt2800mmio_interruptfunction rt2800mmio_toggle_irqfunction rt2800mmio_start_queuefunction rt2800mmio_kick_queuefunction rt2800mmio_flush_queuefunction rt2800mmio_stop_queuefunction rt2800mmio_queue_initfunction rt2800mmio_get_entry_statefunction rt2800mmio_clear_entryfunction rt2800mmio_init_queuesfunction rt2800mmio_init_registersfunction rt2800mmio_enable_radiofunction rt2800mmio_work_txdonefunction rt2800mmio_tx_sta_fifo_timeoutfunction rt2800mmio_probe_hwexport rt2800mmio_get_dma_doneexport rt2800mmio_get_txwiexport rt2800mmio_write_tx_descexport rt2800mmio_fill_rxdoneexport rt2800mmio_pretbtt_taskletexport rt2800mmio_tbtt_taskletexport rt2800mmio_rxdone_taskletexport rt2800mmio_autowake_taskletexport rt2800mmio_txstatus_taskletexport rt2800mmio_interruptexport rt2800mmio_toggle_irqexport rt2800mmio_start_queueexport rt2800mmio_kick_queueexport rt2800mmio_flush_queueexport rt2800mmio_stop_queueexport rt2800mmio_queue_initexport rt2800mmio_get_entry_stateexport rt2800mmio_clear_entryexport rt2800mmio_init_queuesexport rt2800mmio_init_registersexport rt2800mmio_enable_radioexport rt2800mmio_probe_hw
Annotated Snippet
if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
rxdesc->flags |= RX_FLAG_DECRYPTED;
} else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
/*
* In order to check the Michael Mic, the packet must have
* been decrypted. Mac80211 doesnt check the MMIC failure
* flag to initiate MMIC countermeasures if the decoded flag
* has not been set.
*/
rxdesc->flags |= RX_FLAG_DECRYPTED;
rxdesc->flags |= RX_FLAG_MMIC_ERROR;
}
}
if (rt2x00_get_field32(word, RXD_W3_MY_BSS))
rxdesc->dev_flags |= RXDONE_MY_BSS;
if (rt2x00_get_field32(word, RXD_W3_L2PAD))
rxdesc->dev_flags |= RXDONE_L2PAD;
/*
* Process the RXWI structure that is at the start of the buffer.
*/
rt2800_process_rxwi(entry, rxdesc);
}
EXPORT_SYMBOL_GPL(rt2800mmio_fill_rxdone);
/*
* Interrupt functions.
*/
static void rt2800mmio_wakeup(struct rt2x00_dev *rt2x00dev)
{
struct ieee80211_conf conf = { .flags = 0 };
struct rt2x00lib_conf libconf = { .conf = &conf };
rt2800_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS);
}
static inline void rt2800mmio_enable_interrupt(struct rt2x00_dev *rt2x00dev,
struct rt2x00_field32 irq_field)
{
u32 reg;
/*
* Enable a single interrupt. The interrupt mask register
* access needs locking.
*/
spin_lock_irq(&rt2x00dev->irqmask_lock);
reg = rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR);
rt2x00_set_field32(®, irq_field, 1);
rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg);
spin_unlock_irq(&rt2x00dev->irqmask_lock);
}
void rt2800mmio_pretbtt_tasklet(struct tasklet_struct *t)
{
struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t,
pretbtt_tasklet);
rt2x00lib_pretbtt(rt2x00dev);
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
rt2800mmio_enable_interrupt(rt2x00dev, INT_MASK_CSR_PRE_TBTT);
}
EXPORT_SYMBOL_GPL(rt2800mmio_pretbtt_tasklet);
void rt2800mmio_tbtt_tasklet(struct tasklet_struct *t)
{
struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t, tbtt_tasklet);
struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
u32 reg;
rt2x00lib_beacondone(rt2x00dev);
if (rt2x00dev->intf_ap_count) {
/*
* The rt2800pci hardware tbtt timer is off by 1us per tbtt
* causing beacon skew and as a result causing problems with
* some powersaving clients over time. Shorten the beacon
* interval every 64 beacons by 64us to mitigate this effect.
*/
if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 2)) {
reg = rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG);
rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL,
(rt2x00dev->beacon_int * 16) - 1);
rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg);
} else if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 1)) {
reg = rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG);
rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL,
(rt2x00dev->beacon_int * 16));
rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/export.h`, `rt2x00.h`, `rt2x00mmio.h`, `rt2800.h`, `rt2800lib.h`, `rt2800mmio.h`.
- Detected declarations: `function Copyright`, `function rt2800mmio_write_tx_desc`, `function rt2800mmio_fill_rxdone`, `function rt2800mmio_wakeup`, `function rt2800mmio_enable_interrupt`, `function rt2800mmio_pretbtt_tasklet`, `function rt2800mmio_tbtt_tasklet`, `function rt2800mmio_rxdone_tasklet`, `function rt2800mmio_autowake_tasklet`, `function rt2800mmio_fetch_txstatus`.
- 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.