drivers/net/wireless/mediatek/mt76/mt76.h
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76.h- Extension
.h- Size
- 56668 bytes
- Lines
- 2157
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/kernel.hlinux/io.hlinux/spinlock.hlinux/skbuff.hlinux/leds.hlinux/usb.hlinux/average.hlinux/soc/airoha/airoha_offload.hlinux/soc/mediatek/mtk_wed.hnet/mac80211.hnet/page_pool/helpers.hutil.htestmode.h
Detected Declarations
struct mt76_devstruct mt76_phystruct mt76_wcidstruct mt76s_intrstruct mt76_chanctxstruct mt76_vif_linkstruct mt76_reg_pairstruct mt76_bus_opsstruct mt76_scan_rnr_paramstruct mt76_queue_bufstruct mt76_tx_infostruct mt76_queue_entrystruct mt76_queue_regsstruct mt76_queuestruct mt76_mcu_opsstruct mt76_queue_opsstruct mt76_sta_statsstruct mt76_wcidstruct mt76_txqstruct mt76_wed_rro_indstruct mt76_txwi_cachestruct mt76_rx_tidstruct mt76_tx_cbstruct mt76_hw_capstruct mt76_driver_opsstruct mt76_channel_statestruct mt76_sbandstruct mt76_mcustruct mt76_usbstruct mt76u_mcustruct mt76_sdiostruct mt76_mmiostruct mt76_rx_statusstruct mt76_freq_range_powerstruct mt76_testmode_opsstruct mt76_testmode_datastruct mt76_vif_linkstruct mt76_vif_datastruct mt76_phystruct mt76_devstruct mt76_mib_statsstruct mt76_power_limitsstruct mt76_ethtool_worker_infostruct mt76_chanctxenum mt76_bus_typeenum mt76_wed_typeenum mt76_hwrro_modeenum mt76_txq_id
Annotated Snippet
const struct file_operations *ops);
static inline struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
{
return mt76_register_debugfs_fops(&dev->phy, NULL);
}
int mt76_queues_read(struct seq_file *s, void *data);
void mt76_seq_puts_array(struct seq_file *file, const char *str,
s8 *val, int len);
int mt76_eeprom_init(struct mt76_dev *dev, int len);
int mt76_eeprom_override(struct mt76_phy *phy);
int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
const char *cell_name, int len);
struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
int ring_base, void *wed, u32 flags);
static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
int n_desc, int ring_base, void *wed,
u32 flags)
{
struct mt76_queue *q;
q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, wed, flags);
if (IS_ERR(q))
return PTR_ERR(q);
phy->q_tx[qid] = q;
return 0;
}
static inline int mt76_init_mcu_queue(struct mt76_dev *dev, int qid, int idx,
int n_desc, int ring_base)
{
struct mt76_queue *q;
q = mt76_init_queue(dev, qid, idx, n_desc, ring_base, NULL, 0);
if (IS_ERR(q))
return PTR_ERR(q);
dev->q_mcu[qid] = q;
return 0;
}
static inline struct mt76_phy *
mt76_dev_phy(struct mt76_dev *dev, u8 phy_idx)
{
if ((phy_idx == MT_BAND1 && dev->phys[phy_idx]) ||
(phy_idx == MT_BAND2 && dev->phys[phy_idx]))
return dev->phys[phy_idx];
return &dev->phy;
}
static inline struct ieee80211_hw *
mt76_phy_hw(struct mt76_dev *dev, u8 phy_idx)
{
return mt76_dev_phy(dev, phy_idx)->hw;
}
static inline u8 *
mt76_get_txwi_ptr(struct mt76_dev *dev, struct mt76_txwi_cache *t)
{
return (u8 *)t - dev->drv->txwi_size;
}
/* increment with wrap-around */
static inline int mt76_incr(int val, int size)
{
return (val + 1) & (size - 1);
}
/* decrement with wrap-around */
static inline int mt76_decr(int val, int size)
{
return (val - 1) & (size - 1);
}
u8 mt76_ac_to_hwq(u8 ac);
static inline struct ieee80211_txq *
mtxq_to_txq(struct mt76_txq *mtxq)
{
void *ptr = mtxq;
return container_of(ptr, struct ieee80211_txq, drv_priv);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/io.h`, `linux/spinlock.h`, `linux/skbuff.h`, `linux/leds.h`, `linux/usb.h`, `linux/average.h`, `linux/soc/airoha/airoha_offload.h`.
- Detected declarations: `struct mt76_dev`, `struct mt76_phy`, `struct mt76_wcid`, `struct mt76s_intr`, `struct mt76_chanctx`, `struct mt76_vif_link`, `struct mt76_reg_pair`, `struct mt76_bus_ops`, `struct mt76_scan_rnr_param`, `struct mt76_queue_buf`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.