drivers/net/wireless/mediatek/mt76/mt7915/main.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7915/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7915/main.c- Extension
.c- Size
- 48688 bytes
- Lines
- 1825
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/etherdevice.hlinux/platform_device.hlinux/pci.hlinux/module.hmt7915.hmcu.h
Detected Declarations
struct drop_sta_iterfunction mt7915_dev_runningfunction mt7915_runfunction mt7915_startfunction mt7915_stopfunction get_free_idxfunction get_omac_idxfunction mt7915_init_bitrate_maskfunction mt7915_add_interfacefunction mt7915_remove_interfacefunction mt7915_set_channelfunction mt7915_set_keyfunction mt7915_set_sar_specsfunction mt7915_configfunction mt7915_conf_txfunction mt7915_configure_filterfunction mt7915_update_bss_colorfunction mt7915_bss_info_changedfunction mt7915_vif_check_capsfunction mt7915_start_apfunction mt7915_stop_apfunction mt7915_channel_switch_beaconfunction mt7915_mac_sta_addfunction __mt7915_drop_stafunction mt7915_drop_other_stafunction mt7915_mac_sta_eventfunction mt7915_mac_sta_removefunction mt7915_txfunction mt7915_set_rts_thresholdfunction mt7915_ampdu_actionfunction mt7915_get_statsfunction __mt7915_get_tsffunction mt7915_get_tsffunction mt7915_set_tsffunction mt7915_offset_tsffunction mt7915_set_coverage_classfunction mt7915_set_antennafunction mt7915_sta_statisticsfunction mt7915_sta_rc_workfunction mt7915_sta_rc_updatefunction mt7915_set_bitrate_maskfunction mt7915_sta_set_4addrfunction mt7915_sta_set_decap_offloadfunction mt7915_sta_set_txpwrfunction mt7915_get_et_stringsfunction mt7915_get_et_sset_countfunction mt7915_ethtool_workerfunction mt7915_get_et_stats
Annotated Snippet
struct drop_sta_iter {
struct mt7915_dev *dev;
struct ieee80211_hw *hw;
struct ieee80211_vif *vif;
u8 sta_addr[ETH_ALEN];
};
static void
__mt7915_drop_sta(void *ptr, u8 *mac, struct ieee80211_vif *vif)
{
struct drop_sta_iter *data = ptr;
struct ieee80211_sta *sta;
struct mt7915_sta *msta;
if (vif == data->vif || vif->type != NL80211_IFTYPE_AP)
return;
sta = ieee80211_find_sta_by_ifaddr(data->hw, data->sta_addr, mac);
if (!sta)
return;
msta = (struct mt7915_sta *)sta->drv_priv;
mt7915_mcu_add_sta(data->dev, vif, sta, CONN_STATE_DISCONNECT, false);
msta->wcid.sta_disabled = 1;
msta->wcid.sta = 0;
}
static void
mt7915_drop_other_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt76_phy *ext_phy = dev->mt76.phys[MT_BAND1];
struct drop_sta_iter data = {
.dev = dev,
.hw = dev->mphy.hw,
.vif = vif,
};
if (vif->type != NL80211_IFTYPE_AP)
return;
memcpy(data.sta_addr, sta->addr, ETH_ALEN);
ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data);
if (!ext_phy)
return;
data.hw = ext_phy->hw;
ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data);
}
int mt7915_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, enum mt76_sta_event ev)
{
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
int i, ret;
u32 addr;
switch (ev) {
case MT76_STA_EVENT_ASSOC:
ret = mt7915_mcu_add_sta(dev, vif, sta, CONN_STATE_CONNECT, true);
if (ret)
return ret;
addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 30);
mt76_rmw_field(dev, addr, GENMASK(7, 0), 0xa0);
ret = mt7915_mcu_add_rate_ctrl(dev, vif, sta, false);
if (ret)
return ret;
msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
msta->wcid.sta = 1;
msta->wcid.sta_disabled = 0;
return 0;
case MT76_STA_EVENT_AUTHORIZE:
mt7915_drop_other_sta(dev, vif, sta);
return mt7915_mcu_add_sta(dev, vif, sta, CONN_STATE_PORT_SECURE, false);
case MT76_STA_EVENT_DISASSOC:
mutex_lock(&dev->mt76.mutex);
for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++)
mt7915_mac_twt_teardown_flow(dev, msta, i);
mutex_unlock(&dev->mt76.mutex);
mt7915_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, false);
msta->wcid.sta_disabled = 1;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/platform_device.h`, `linux/pci.h`, `linux/module.h`, `mt7915.h`, `mcu.h`.
- Detected declarations: `struct drop_sta_iter`, `function mt7915_dev_running`, `function mt7915_run`, `function mt7915_start`, `function mt7915_stop`, `function get_free_idx`, `function get_omac_idx`, `function mt7915_init_bitrate_mask`, `function mt7915_add_interface`, `function mt7915_remove_interface`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.