drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c- Extension
.c- Size
- 35545 bytes
- Lines
- 1494
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/firmware.hmt7921.hregd.hmcu.h../mt76_connac2_mac.h../mt792x_trace.h
Detected Declarations
struct mt7921_debug_msgstruct mt7921_mcu_lp_eventstruct mt7921_tx_resourcestruct mt7921_phy_capstruct mt76_connac_cap_hdrstruct tlv_hdrstruct edcastruct mt7921_mcu_txstruct mu_edcastruct mt7921_mcu_mu_txstruct roc_acquire_tlvstruct roc_abort_tlvstruct req_hdrstruct ps_tlvstruct bcnft_tlvstruct sniffer_enable_tlvstruct config_tlvstruct req_hdrstruct bcn_content_tlvfunction mt7921_mcu_parse_responsefunction mt7921_mcu_read_eepromfunction mt7921_mcu_set_ipv6_ns_filterfunction mt7921_mcu_set_suspend_iterfunction mt7921_mcu_uni_roc_eventfunction mt7921_mcu_scan_eventfunction mt7921_mcu_connection_loss_iterfunction mt7921_mcu_connection_loss_eventfunction mt7921_mcu_debug_msg_eventfunction mt7921_mcu_low_power_eventfunction mt7921_mcu_tx_done_eventfunction mt7921_mcu_rssi_monitor_iterfunction mt7921_mcu_rssi_monitor_eventfunction mt7921_mcu_rx_unsolicited_eventfunction mt7921_mcu_uni_rx_unsolicited_eventfunction mt7921_mcu_rx_eventfunction mt7921_mcu_uni_tx_bafunction mt7921_mcu_uni_rx_bafunction mt7921_load_clcfunction mt7921_mcu_parse_tx_resourcefunction mt7921_mcu_parse_phy_capfunction mt7921_mcu_get_nic_capabilityfunction mt7921_mcu_fw_log_2_hostfunction mt7921_run_firmwarefunction mt7921_mcu_radio_led_ctrlfunction mt7921_mcu_set_txfunction mt7921_mcu_set_rocfunction mt7921_mcu_abort_rocfunction mt7921_mcu_set_chan_info
Annotated Snippet
struct mt7921_debug_msg {
__le16 id;
u8 type;
u8 flag;
__le32 value;
__le16 len;
u8 content[512];
} __packed * msg;
skb_pull(skb, sizeof(struct mt76_connac2_mcu_rxd));
msg = (struct mt7921_debug_msg *)skb->data;
if (msg->type == 3) { /* fw log */
u16 len = min_t(u16, le16_to_cpu(msg->len), 512);
int i;
for (i = 0 ; i < len; i++) {
if (!msg->content[i])
msg->content[i] = ' ';
}
wiphy_info(mt76_hw(dev)->wiphy, "%.*s", len, msg->content);
}
}
static void
mt7921_mcu_low_power_event(struct mt792x_dev *dev, struct sk_buff *skb)
{
struct mt7921_mcu_lp_event {
u8 state;
u8 reserved[3];
} __packed * event;
skb_pull(skb, sizeof(struct mt76_connac2_mcu_rxd));
event = (struct mt7921_mcu_lp_event *)skb->data;
trace_lp_event(dev, event->state);
}
static void
mt7921_mcu_tx_done_event(struct mt792x_dev *dev, struct sk_buff *skb)
{
struct mt7921_mcu_tx_done_event *event;
skb_pull(skb, sizeof(struct mt76_connac2_mcu_rxd));
event = (struct mt7921_mcu_tx_done_event *)skb->data;
mt7921_mac_add_txs(dev, event->txs);
}
static void
mt7921_mcu_rssi_monitor_iter(void *priv, u8 *mac,
struct ieee80211_vif *vif)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt76_connac_rssi_notify_event *event = priv;
enum nl80211_cqm_rssi_threshold_event nl_event;
s32 rssi = le32_to_cpu(event->rssi[mvif->bss_conf.mt76.idx]);
if (!rssi)
return;
if (!(vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI))
return;
if (rssi > vif->bss_conf.cqm_rssi_thold)
nl_event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH;
else
nl_event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW;
ieee80211_cqm_rssi_notify(vif, nl_event, rssi, GFP_KERNEL);
}
static void
mt7921_mcu_rssi_monitor_event(struct mt792x_dev *dev, struct sk_buff *skb)
{
struct mt76_connac_rssi_notify_event *event;
skb_pull(skb, sizeof(struct mt76_connac2_mcu_rxd));
event = (struct mt76_connac_rssi_notify_event *)skb->data;
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
IEEE80211_IFACE_ITER_RESUME_ALL,
mt7921_mcu_rssi_monitor_iter, event);
}
static void
mt7921_mcu_rx_unsolicited_event(struct mt792x_dev *dev, struct sk_buff *skb)
{
struct mt76_connac2_mcu_rxd *rxd;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/firmware.h`, `mt7921.h`, `regd.h`, `mcu.h`, `../mt76_connac2_mac.h`, `../mt792x_trace.h`.
- Detected declarations: `struct mt7921_debug_msg`, `struct mt7921_mcu_lp_event`, `struct mt7921_tx_resource`, `struct mt7921_phy_cap`, `struct mt76_connac_cap_hdr`, `struct tlv_hdr`, `struct edca`, `struct mt7921_mcu_tx`, `struct mu_edca`, `struct mt7921_mcu_mu_tx`.
- 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.
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.