drivers/net/wireless/mediatek/mt76/mt7615/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7615/mac.c- Extension
.c- Size
- 61017 bytes
- Lines
- 2346
- 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/devcoredump.hlinux/etherdevice.hlinux/timekeeping.hmt7615.h../trace.h../dma.hmt7615_trace.hmac.hmcu.h
Detected Declarations
function mt7615_mac_get_cipherfunction mt7615_mac_reset_countersfunction mt7615_mac_set_timingfunction mt7615_get_status_freq_infofunction mt7615_mac_fill_tm_rxfunction mt7615_reverse_frag0_hdr_transfunction mt7615_mac_fill_rxfunction mt7615_mac_tx_rate_valfunction mt7615_mac_write_txwifunction mt7615_mac_wtbl_updatefunction mt7615_mac_sta_pollfunction mt7615_mac_update_rate_descfunction mt7615_mac_queue_rate_updatefunction mt7615_mac_get_sta_tid_snfunction mt7615_mac_set_ratesfunction mt7615_mac_wtbl_update_keyfunction mt7615_mac_wtbl_update_pkfunction mt7615_mac_wtbl_update_cipherfunction __mt7615_mac_wtbl_set_keyfunction mt7615_mac_wtbl_set_keyfunction mt7615_fill_txsfunction mt7615_mac_add_txs_skbfunction mt7615_mac_add_txsfunction mt7615_txwi_freefunction mt7615_mac_tx_free_tokenfunction mt7615_mac_tx_freefunction mt7615_rx_checkfunction mt7615_queue_rx_skbfunction mt7615_mac_set_sensitivityfunction mt7615_mac_set_default_sensitivityfunction mt7615_mac_set_scsfunction mt7615_mac_enable_nffunction mt7615_mac_cca_stats_resetfunction mt7615_mac_adjust_sensitivityfunction mt7615_mac_scs_checkfunction mt7615_phy_get_nffunction mt7615_phy_update_channelfunction mt7615_update_surveyfunction mt7615_update_channelfunction mt7615_mac_update_mib_statsfunction mt7615_pm_wake_workfunction mt7615_pm_power_save_workfunction mt7615_mac_workfunction mt7615_tx_token_putfunction mt7615_dfs_stop_radar_detectorfunction mt7615_dfs_start_rddfunction mt7615_dfs_start_radar_detectorfunction mt7615_dfs_init_radar_specs
Annotated Snippet
if (status->flag & RX_FLAG_DECRYPTED) {
switch (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2)) {
case MT_CIPHER_AES_CCMP:
case MT_CIPHER_CCMP_CCX:
case MT_CIPHER_CCMP_256:
insert_ccmp_hdr =
FIELD_GET(MT_RXD2_NORMAL_FRAG, rxd2);
fallthrough;
case MT_CIPHER_TKIP:
case MT_CIPHER_TKIP_NO_MIC:
case MT_CIPHER_GCMP:
case MT_CIPHER_GCMP_256:
status->iv[0] = data[5];
status->iv[1] = data[4];
status->iv[2] = data[3];
status->iv[3] = data[2];
status->iv[4] = data[1];
status->iv[5] = data[0];
break;
default:
break;
}
}
rxd += 4;
if ((u8 *)rxd - skb->data >= skb->len)
return -EINVAL;
}
if (rxd0 & MT_RXD0_NORMAL_GROUP_2) {
status->timestamp = le32_to_cpu(rxd[0]);
status->flag |= RX_FLAG_MACTIME_START;
if (!(rxd2 & (MT_RXD2_NORMAL_NON_AMPDU_SUB |
MT_RXD2_NORMAL_NON_AMPDU))) {
status->flag |= RX_FLAG_AMPDU_DETAILS;
/* all subframes of an A-MPDU have the same timestamp */
if (phy->rx_ampdu_ts != status->timestamp) {
if (!++phy->ampdu_ref)
phy->ampdu_ref++;
}
phy->rx_ampdu_ts = status->timestamp;
status->ampdu_ref = phy->ampdu_ref;
}
rxd += 2;
if ((u8 *)rxd - skb->data >= skb->len)
return -EINVAL;
}
if (rxd0 & MT_RXD0_NORMAL_GROUP_3) {
u32 rxdg5 = le32_to_cpu(rxd[5]);
/*
* If both PHYs are on the same channel and we don't have a WCID,
* we need to figure out which PHY this packet was received on.
* On the primary PHY, the noise value for the chains belonging to the
* second PHY will be set to the noise value of the last packet from
* that PHY.
*/
if (phy_idx < 0) {
int first_chain = ffs(phy2->mt76->chainmask) - 1;
phy_idx = ((rxdg5 >> (first_chain * 8)) & 0xff) == 0;
}
}
if (phy_idx == 1 && phy2) {
mphy = dev->mt76.phys[MT_BAND1];
phy = phy2;
status->phy_idx = phy_idx;
}
if (!mt7615_firmware_offload(dev) && chfreq != phy->chfreq)
return -EINVAL;
mt7615_get_status_freq_info(dev, mphy, status, chfreq);
if (status->band == NL80211_BAND_5GHZ)
sband = &mphy->sband_5g.sband;
else
sband = &mphy->sband_2g.sband;
if (!test_bit(MT76_STATE_RUNNING, &mphy->state))
return -EINVAL;
if (!sband->channels)
return -EINVAL;
if (rxd0 & MT_RXD0_NORMAL_GROUP_3) {
Annotation
- Immediate include surface: `linux/devcoredump.h`, `linux/etherdevice.h`, `linux/timekeeping.h`, `mt7615.h`, `../trace.h`, `../dma.h`, `mt7615_trace.h`, `mac.h`.
- Detected declarations: `function mt7615_mac_get_cipher`, `function mt7615_mac_reset_counters`, `function mt7615_mac_set_timing`, `function mt7615_get_status_freq_info`, `function mt7615_mac_fill_tm_rx`, `function mt7615_reverse_frag0_hdr_trans`, `function mt7615_mac_fill_rx`, `function mt7615_mac_tx_rate_val`, `function mt7615_mac_write_txwi`, `function mt7615_mac_wtbl_update`.
- 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.