# openwrt/mt76 architecture

> Architecture diagram of the GitHub repository openwrt/mt76, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openwrt/mt76
- Repository: https://github.com/openwrt/mt76

## Overview

mt76 is a Linux kernel wireless-driver framework for MediaTek Wi-Fi hardware, with shared data-path and device support plus drivers for multiple chip families and bus types. The principal workflow is the kernel wireless stack invoking driver operations, which configure interfaces and stations, send firmware commands, and move packets through hardware queues. The tree also shows scanning, EEPROM handling, test mode, diagnostics, and newer offload/NAN features. Evidence is uneven: several family implementations are unsampled, so only directly visible or indexed relationships are connected.

Main entry points: [`mt76.h`](https://github.com/openwrt/mt76/blob/master/mt76.h) (Shared Device Core), [`mt7915`](https://github.com/openwrt/mt76/tree/master/mt7915) (MT7915 Driver), [`mt7925`](https://github.com/openwrt/mt76/tree/master/mt7925) (MT7925 Driver), [`mt7603`](https://github.com/openwrt/mt76/tree/master/mt7603) (MT7603 Driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_common["Shared Driver Core"]
  node_mac80211["Driver Operations<br/>[mac80211.c]"]
  node_core["Shared Device Core<br/>[mt76.h]"]
  node_tx["Packet Handling<br/>[tx.c]"]
  node_dma["DMA Queues<br/>[dma.c]"]
  node_connac["Connac Firmware<br/>[mt76_connac_mcu.c]"]
end

subgraph group_legacy["Legacy Chip Drivers"]
  node_mt7603["MT7603 Driver"]
  node_mt76x0["MT76x0 Driver"]
  node_mt76x2["MT76x2 Driver"]
  node_mt7615["MT7615 Driver"]
end

subgraph group_modern["Modern Chip Drivers"]
  node_mt7915["MT7915 Driver"]
  node_mt7921["MT7921 Driver"]
  node_mt7925["MT7925 Driver"]
  node_mt7996["MT7996 Driver"]
end

subgraph group_services["Wireless Services"]
  node_scan["Hardware Scanning<br/>[scan.c]"]
  node_eeprom["EEPROM Support<br/>[eeprom.c]"]
  node_testmode["Test Mode<br/>[testmode.c]"]
  node_debugfs["Diagnostics<br/>[debugfs.c]"]
  node_nan["NAN Support<br/>[nan.c]"]
end

node_wireless(("Kernel Wireless Stack"))
node_device["Wi-Fi Hardware"]

node_wireless -.->|"invokes operations"| node_mac80211
node_mac80211 -->|"uses shared API"| node_core
node_core -.->|"queues packets"| node_tx
node_core -.->|"manages queues"| node_dma
node_mt7603 -.->|"uses framework"| node_core
node_mt76x0 -.->|"uses framework"| node_core
node_mt76x2 -.->|"uses framework"| node_core
node_mt7615 -.->|"uses framework"| node_core
node_mt7915 -.->|"uses framework"| node_core
node_mt7921 -.->|"uses framework"| node_core
node_mt7925 -.->|"uses framework"| node_core
node_mt7996 -.->|"uses framework"| node_core
node_mt7915 -->|"sends firmware commands"| node_device
node_mt7996 -->|"sends firmware commands"| node_device
node_mt7925 -->|"sends firmware commands"| node_device
node_mt7925 -->|"updates peer records"| node_nan
node_connac -->|"sends MCU messages"| node_device
node_mt7915 -.->|"supports scanning"| node_scan
node_mt7921 -.->|"handles scan events"| node_scan
node_mt7603 -.->|"uses calibration data"| node_eeprom
node_mt7615 -.->|"exposes test controls"| node_testmode
node_mt7915 -.->|"exposes diagnostics"| node_debugfs

click node_mac80211 "https://github.com/openwrt/mt76/blob/master/mac80211.c"
click node_core "https://github.com/openwrt/mt76/blob/master/mt76.h"
click node_tx "https://github.com/openwrt/mt76/blob/master/tx.c"
click node_dma "https://github.com/openwrt/mt76/blob/master/dma.c"
click node_connac "https://github.com/openwrt/mt76/blob/master/mt76_connac_mcu.c"
click node_mt7603 "https://github.com/openwrt/mt76/tree/master/mt7603"
click node_mt76x0 "https://github.com/openwrt/mt76/tree/master/mt76x0"
click node_mt76x2 "https://github.com/openwrt/mt76/tree/master/mt76x2"
click node_mt7615 "https://github.com/openwrt/mt76/tree/master/mt7615"
click node_mt7915 "https://github.com/openwrt/mt76/tree/master/mt7915"
click node_mt7921 "https://github.com/openwrt/mt76/tree/master/mt7921"
click node_mt7925 "https://github.com/openwrt/mt76/tree/master/mt7925"
click node_mt7996 "https://github.com/openwrt/mt76/tree/master/mt7996"
click node_scan "https://github.com/openwrt/mt76/blob/master/scan.c"
click node_eeprom "https://github.com/openwrt/mt76/blob/master/eeprom.c"
click node_testmode "https://github.com/openwrt/mt76/blob/master/testmode.c"
click node_debugfs "https://github.com/openwrt/mt76/blob/master/debugfs.c"
click node_nan "https://github.com/openwrt/mt76/blob/master/mt7925/nan.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mac80211,node_core,node_tx,node_dma,node_connac toneBlue
class node_mt7603,node_mt76x0,node_mt76x2,node_mt7615 toneAmber
class node_mt7915,node_mt7921,node_mt7925,node_mt7996 toneMint
class node_scan,node_eeprom,node_testmode,node_debugfs,node_nan toneRose
class node_wireless,node_device toneIndigo
```

## Components

### Shared Driver Core

- [Driver Operations](https://github.com/openwrt/mt76/blob/master/mac80211.c): `mac80211.c`
- [Shared Device Core](https://github.com/openwrt/mt76/blob/master/mt76.h): `mt76.h`
- [Packet Handling](https://github.com/openwrt/mt76/blob/master/tx.c): `tx.c`
- [DMA Queues](https://github.com/openwrt/mt76/blob/master/dma.c): `dma.c`
- [Connac Firmware](https://github.com/openwrt/mt76/blob/master/mt76_connac_mcu.c): `mt76_connac_mcu.c`

### Legacy Chip Drivers

- [MT7603 Driver](https://github.com/openwrt/mt76/tree/master/mt7603): `mt7603`
- [MT76x0 Driver](https://github.com/openwrt/mt76/tree/master/mt76x0): `mt76x0`
- [MT76x2 Driver](https://github.com/openwrt/mt76/tree/master/mt76x2): `mt76x2`
- [MT7615 Driver](https://github.com/openwrt/mt76/tree/master/mt7615): `mt7615`

### Modern Chip Drivers

- [MT7915 Driver](https://github.com/openwrt/mt76/tree/master/mt7915): `mt7915`
- [MT7921 Driver](https://github.com/openwrt/mt76/tree/master/mt7921): `mt7921`
- [MT7925 Driver](https://github.com/openwrt/mt76/tree/master/mt7925): `mt7925`
- [MT7996 Driver](https://github.com/openwrt/mt76/tree/master/mt7996): `mt7996`

### Wireless Services

- [Hardware Scanning](https://github.com/openwrt/mt76/blob/master/scan.c): `scan.c`
- [EEPROM Support](https://github.com/openwrt/mt76/blob/master/eeprom.c): `eeprom.c`
- [Test Mode](https://github.com/openwrt/mt76/blob/master/testmode.c): `testmode.c`
- [Diagnostics](https://github.com/openwrt/mt76/blob/master/debugfs.c): `debugfs.c`
- [NAN Support](https://github.com/openwrt/mt76/blob/master/mt7925/nan.c): `mt7925/nan.c`

### Other components

- **Kernel Wireless Stack**
- **Wi-Fi Hardware**

## Connections

- Kernel Wireless Stack → Driver Operations: invokes operations
- Driver Operations → Shared Device Core: uses shared API (evidence: `mac80211.c`)
- Shared Device Core → Packet Handling: queues packets
- Shared Device Core → DMA Queues: manages queues
- MT7603 Driver → Shared Device Core: uses framework (evidence: `mt7603/mt7603.h`)
- MT76x0 Driver → Shared Device Core: uses framework
- MT76x2 Driver → Shared Device Core: uses framework
- MT7615 Driver → Shared Device Core: uses framework
- MT7915 Driver → Shared Device Core: uses framework
- MT7921 Driver → Shared Device Core: uses framework
- MT7925 Driver → Shared Device Core: uses framework
- MT7996 Driver → Shared Device Core: uses framework
- MT7915 Driver → Wi-Fi Hardware: sends firmware commands (evidence: `mt7915/mcu.c`)
- MT7996 Driver → Wi-Fi Hardware: sends firmware commands (evidence: `mt7996/mcu.c`)
- MT7925 Driver → Wi-Fi Hardware: sends firmware commands (evidence: `mt7925/mcu.c`)
- MT7925 Driver → NAN Support: updates peer records (evidence: `mt7925/main.c`)
- Connac Firmware → Wi-Fi Hardware: sends MCU messages (evidence: `mt76_connac_mcu.c`)
- MT7915 Driver → Hardware Scanning: supports scanning
- MT7921 Driver → Hardware Scanning: handles scan events
- MT7603 Driver → EEPROM Support: uses calibration data
- MT7615 Driver → Test Mode: exposes test controls
- MT7915 Driver → Diagnostics: exposes diagnostics
