drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c- Extension
.c- Size
- 33175 bytes
- Lines
- 1229
- 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
mt76_connac.hmt76_connac2_mac.hdma.h
Detected Declarations
function mt76_connac_gen_ppe_threshfunction mt76_connac_pm_wakefunction mt76_connac_power_save_schedfunction mt76_connac_free_pending_tx_skbsfunction mt76_connac_pm_queue_skbfunction mt76_connac_pm_dequeue_skbsfunction mt76_connac_tx_complete_skbfunction mt76_connac_write_hw_txpfunction mt76_connac_txp_skb_unmap_fwfunction mt76_connac_txp_skb_unmap_hwfunction mt76_connac_txp_skb_unmapfunction mt76_connac_init_tx_queuesfunction mt76_connac_set_txpower_curfunction mt76_connac2_mac_tx_rate_valfunction mt76_connac2_mac_write_txwi_8023function mt76_connac2_mac_write_txwi_80211function mt76_connac2_mac_write_txwifunction mt76_connac2_mac_fill_txsfunction FIELD_GETfunction mt76_connac2_mac_add_txs_skbfunction mt76_connac2_mac_decode_he_radiotap_rufunction mt76_connac2_mac_decode_he_mu_radiotapfunction mt76_connac2_mac_decode_he_radiotapfunction mt76_connac2_reverse_frag0_hdr_transfunction mt76_connac2_mac_fill_rx_ratefunction mt76_connac2_tx_check_aggrfunction mt76_connac2_txwi_freefunction mt76_connac2_tx_token_putexport mt76_connac_gen_ppe_threshexport mt76_connac_pm_wakeexport mt76_connac_power_save_schedexport mt76_connac_free_pending_tx_skbsexport mt76_connac_pm_queue_skbexport mt76_connac_pm_dequeue_skbsexport mt76_connac_tx_complete_skbexport mt76_connac_write_hw_txpexport mt76_connac_txp_skb_unmapexport mt76_connac_init_tx_queuesexport mt76_connac_set_txpower_curexport mt76_connac2_mac_tx_rate_valexport mt76_connac2_mac_write_txwiexport mt76_connac2_mac_fill_txsexport mt76_connac2_mac_add_txs_skbexport mt76_connac2_mac_decode_he_radiotapexport mt76_connac2_reverse_frag0_hdr_transexport mt76_connac2_mac_fill_rx_rateexport mt76_connac2_tx_check_aggrexport mt76_connac2_txwi_free
Annotated Snippet
if (i & 1) {
ptr->buf1 = cpu_to_le32(addr);
ptr->len1 = cpu_to_le16(len);
ptr++;
} else {
ptr->buf0 = cpu_to_le32(addr);
ptr->len0 = cpu_to_le16(len);
}
}
}
EXPORT_SYMBOL_GPL(mt76_connac_write_hw_txp);
static void
mt76_connac_txp_skb_unmap_fw(struct mt76_dev *mdev,
struct mt76_connac_fw_txp *txp)
{
struct device *dev = is_connac_v1(mdev) ? mdev->dev : mdev->dma_dev;
int i;
for (i = 0; i < txp->nbuf; i++)
dma_unmap_single(dev, le32_to_cpu(txp->buf[i]),
le16_to_cpu(txp->len[i]), DMA_TO_DEVICE);
}
static void
mt76_connac_txp_skb_unmap_hw(struct mt76_dev *dev,
struct mt76_connac_hw_txp *txp)
{
u32 last_mask;
int i;
if (is_mt7663(dev) || is_connac2(dev) || is_connac3(dev))
last_mask = MT_TXD_LEN_LAST;
else
last_mask = MT_TXD_LEN_MSDU_LAST;
for (i = 0; i < ARRAY_SIZE(txp->ptr); i++) {
struct mt76_connac_txp_ptr *ptr = &txp->ptr[i];
bool last;
u16 len;
len = le16_to_cpu(ptr->len0);
last = len & last_mask;
len &= MT_TXD_LEN_MASK;
dma_unmap_single(dev->dev, le32_to_cpu(ptr->buf0), len,
DMA_TO_DEVICE);
if (last)
break;
len = le16_to_cpu(ptr->len1);
last = len & last_mask;
len &= MT_TXD_LEN_MASK;
dma_unmap_single(dev->dev, le32_to_cpu(ptr->buf1), len,
DMA_TO_DEVICE);
if (last)
break;
}
}
void mt76_connac_txp_skb_unmap(struct mt76_dev *dev,
struct mt76_txwi_cache *t)
{
struct mt76_connac_txp_common *txp;
txp = mt76_connac_txwi_to_txp(dev, t);
if (is_mt76_fw_txp(dev))
mt76_connac_txp_skb_unmap_fw(dev, &txp->fw);
else
mt76_connac_txp_skb_unmap_hw(dev, &txp->hw);
}
EXPORT_SYMBOL_GPL(mt76_connac_txp_skb_unmap);
int mt76_connac_init_tx_queues(struct mt76_phy *phy, int idx, int n_desc,
int ring_base, void *wed, u32 flags)
{
int i, err;
err = mt76_init_tx_queue(phy, 0, idx, n_desc, ring_base,
wed, flags);
if (err < 0)
return err;
for (i = 1; i <= MT_TXQ_PSD; i++)
phy->q_tx[i] = phy->q_tx[0];
return 0;
}
EXPORT_SYMBOL_GPL(mt76_connac_init_tx_queues);
void mt76_connac_set_txpower_cur(struct mt76_phy *phy, s8 max_power)
Annotation
- Immediate include surface: `mt76_connac.h`, `mt76_connac2_mac.h`, `dma.h`.
- Detected declarations: `function mt76_connac_gen_ppe_thresh`, `function mt76_connac_pm_wake`, `function mt76_connac_power_save_sched`, `function mt76_connac_free_pending_tx_skbs`, `function mt76_connac_pm_queue_skb`, `function mt76_connac_pm_dequeue_skbs`, `function mt76_connac_tx_complete_skb`, `function mt76_connac_write_hw_txp`, `function mt76_connac_txp_skb_unmap_fw`, `function mt76_connac_txp_skb_unmap_hw`.
- 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.