drivers/net/wireless/mediatek/mt76/mac80211.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mac80211.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mac80211.c- Extension
.c- Size
- 57797 bytes
- Lines
- 2361
- 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.
- 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/sched.hlinux/of.hmt76.h
Detected Declarations
struct mt76_offchannel_cb_datastruct mt76_rx_beacon_datafunction Copyrightfunction mt76_led_initfunction mt76_led_cleanupfunction mt76_init_stream_capfunction mt76_set_stream_capsfunction mt76_init_sbandfunction mt76_init_sband_2gfunction mt76_init_sband_5gfunction mt76_init_sband_6gfunction mt76_check_sbandfunction mt76_phy_initfunction mt76_alloc_radio_phyfunction mt76_alloc_phyfunction mt76_register_phyfunction mt76_unregister_phyfunction mt76_create_page_poolfunction mt76_alloc_devicefunction mt76_register_devicefunction mt76_unregister_devicefunction mt76_free_devicefunction mt76_reset_phyfunction mt76_reset_devicefunction mt76_rx_release_amsdufunction mt76_rx_release_burstfunction mt76_rxfunction mt76_has_tx_pendingfunction mt76_channel_statefunction mt76_update_survey_active_timefunction mt76_update_surveyfunction __mt76_set_channelfunction mt76_set_channelfunction mt76_update_channelfunction mt76_get_survey_sbandfunction mt76_get_surveyfunction mt76_wcid_key_setupfunction mt76_rx_signalfunction mt76_rx_convertfunction mt76_check_ccmp_pnfunction mt76_airtime_reportfunction mt76_airtime_flush_ampdufunction mt76_airtime_checkfunction mt76_check_stafunction mt76_rx_completefunction list_for_each_entry_safefunction mt76_rx_poll_completefunction mt76_sta_add
Annotated Snippet
struct mt76_offchannel_cb_data {
struct mt76_phy *phy;
bool offchannel;
};
static void
mt76_offchannel_send_nullfunc(struct mt76_offchannel_cb_data *data,
struct ieee80211_vif *vif, int link_id)
{
struct mt76_phy *phy = data->phy;
struct ieee80211_tx_info *info;
struct ieee80211_sta *sta = NULL;
struct ieee80211_hdr *hdr;
struct mt76_wcid *wcid;
struct sk_buff *skb;
skb = ieee80211_nullfunc_get(phy->hw, vif, link_id, true);
if (!skb)
return;
hdr = (struct ieee80211_hdr *)skb->data;
if (data->offchannel)
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
skb->priority = 7;
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
if (!ieee80211_tx_prepare_skb(phy->hw, vif, skb,
phy->main_chandef.chan->band,
&sta))
return;
if (sta)
wcid = (struct mt76_wcid *)sta->drv_priv;
else
wcid = ((struct mt76_vif_link *)vif->drv_priv)->wcid;
if (link_id >= 0) {
info = IEEE80211_SKB_CB(skb);
info->control.flags &= ~IEEE80211_TX_CTRL_MLO_LINK;
info->control.flags |=
u32_encode_bits(link_id, IEEE80211_TX_CTRL_MLO_LINK);
}
mt76_tx(phy, sta, wcid, skb);
}
static void
mt76_offchannel_notify_iter(void *_data, u8 *mac, struct ieee80211_vif *vif)
{
struct mt76_offchannel_cb_data *data = _data;
struct mt76_vif_link *mlink;
struct mt76_vif_data *mvif;
int link_id;
if (vif->type != NL80211_IFTYPE_STATION || !vif->cfg.assoc)
return;
mlink = (struct mt76_vif_link *)vif->drv_priv;
mvif = mlink->mvif;
if (!ieee80211_vif_is_mld(vif)) {
if (mt76_vif_link_phy(mlink) == data->phy) {
if (!data->offchannel && mlink->beacon_mon_interval)
WRITE_ONCE(mlink->beacon_mon_last, jiffies);
mt76_offchannel_send_nullfunc(data, vif, -1);
}
return;
}
for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
if (link_id == mvif->deflink_id)
mlink = (struct mt76_vif_link *)vif->drv_priv;
else
mlink = rcu_dereference(mvif->link[link_id]);
if (!mlink)
continue;
if (mt76_vif_link_phy(mlink) != data->phy)
continue;
if (!data->offchannel && mlink->beacon_mon_interval)
WRITE_ONCE(mlink->beacon_mon_last, jiffies);
mt76_offchannel_send_nullfunc(data, vif, link_id);
}
}
void mt76_offchannel_notify(struct mt76_phy *phy, bool offchannel)
{
struct mt76_offchannel_cb_data data = {
Annotation
- Immediate include surface: `linux/sched.h`, `linux/of.h`, `mt76.h`.
- Detected declarations: `struct mt76_offchannel_cb_data`, `struct mt76_rx_beacon_data`, `function Copyright`, `function mt76_led_init`, `function mt76_led_cleanup`, `function mt76_init_stream_cap`, `function mt76_set_stream_caps`, `function mt76_init_sband`, `function mt76_init_sband_2g`, `function mt76_init_sband_5g`.
- 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.