drivers/net/wireless/realtek/rtw89/pci.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/pci.c- Extension
.c- Size
- 135190 bytes
- Lines
- 4880
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hmac.hpci.hreg.hser.h
Detected Declarations
function rtw89_pci_get_phy_offset_by_link_speedfunction rtw89_pci_rst_bdram_axfunction rtw89_pci_dma_recalcfunction rtw89_pci_txbd_recalcfunction rtw89_pci_release_fwcmdfunction rtw89_pci_reclaim_tx_fwcmdfunction rtw89_pci_rxbd_recalcfunction rtw89_pci_sync_skb_for_cpufunction rtw89_pci_sync_skb_for_devicefunction rtw89_pci_rxbd_info_updatefunction rtw89_pci_validate_rx_tagfunction rtw89_pci_sync_skb_for_device_and_validate_rx_infofunction rtw89_pci_ctrl_txdma_ch_axfunction rtw89_pci_ctrl_txdma_fw_ch_axfunction rtw89_skb_put_rx_datafunction rtw89_pci_get_rx_skb_idxfunction rtw89_pci_rxbd_deliver_skbsfunction rtw89_pci_rxbd_deliverfunction rtw89_pci_poll_rxq_dmafunction rtw89_pci_tx_statusfunction rtw89_pci_reclaim_txbdfunction rtw89_pci_release_busy_txwdfunction rtw89_pci_release_txwd_skbfunction skb_queue_walk_safefunction rtw89_pci_parse_rppfunction rtw89_pci_parse_rpp_v1function rtw89_pci_release_rppfunction rtw89_pci_release_pending_txwd_skbfunction rtw89_pci_release_tx_skbsfunction rtw89_pci_release_txfunction rtw89_pci_poll_rpq_dmafunction rtw89_pci_isr_rxd_unavailfunction rtw89_pci_recognize_intrsfunction rtw89_pci_recognize_intrs_v1function rtw89_pci_recognize_intrs_v2function rtw89_pci_recognize_intrs_v3function rtw89_pci_enable_intrfunction rtw89_pci_disable_intrfunction rtw89_pci_enable_intr_v1function rtw89_pci_disable_intr_v1function rtw89_pci_enable_intr_v2function rtw89_pci_disable_intr_v2function rtw89_pci_enable_intr_v3function rtw89_pci_disable_intr_v3function rtw89_pci_ops_recovery_startfunction rtw89_pci_ops_recovery_completefunction rtw89_pci_low_power_interrupt_handlerfunction rtw89_pci_interrupt_threadfn
Annotated Snippet
if (!skb) {
rtw89_err(rtwdev, "failed to pre-release fwcmd\n");
return;
}
skb_queue_tail(&rtwpci->h2c_release_queue, skb);
}
qlen = skb_queue_len(&rtwpci->h2c_release_queue);
if (!release_all)
qlen = qlen > RTW89_PCI_MULTITAG ? qlen - RTW89_PCI_MULTITAG : 0;
while (qlen--) {
skb = skb_dequeue(&rtwpci->h2c_release_queue);
if (!skb) {
rtw89_err(rtwdev, "failed to release fwcmd\n");
return;
}
tx_data = RTW89_PCI_TX_SKB_CB(skb);
dma_unmap_single(&rtwpci->pdev->dev, tx_data->dma, skb->len,
DMA_TO_DEVICE);
dev_kfree_skb_any(skb);
}
}
static void rtw89_pci_reclaim_tx_fwcmd(struct rtw89_dev *rtwdev,
struct rtw89_pci *rtwpci)
{
struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx.rings[RTW89_TXCH_CH12];
u32 cnt;
cnt = rtw89_pci_txbd_recalc(rtwdev, tx_ring);
if (!cnt)
return;
rtw89_pci_release_fwcmd(rtwdev, rtwpci, cnt, false);
}
static u32 rtw89_pci_rxbd_recalc(struct rtw89_dev *rtwdev,
struct rtw89_pci_rx_ring *rx_ring)
{
struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring;
u32 addr_idx = bd_ring->addr.idx;
u32 cnt, idx;
idx = rtw89_read32(rtwdev, addr_idx);
cnt = rtw89_pci_dma_recalc(rtwdev, bd_ring, idx, false);
return cnt;
}
static void rtw89_pci_sync_skb_for_cpu(struct rtw89_dev *rtwdev,
struct sk_buff *skb)
{
struct rtw89_pci_rx_info *rx_info;
dma_addr_t dma;
rx_info = RTW89_PCI_RX_SKB_CB(skb);
dma = rx_info->dma;
dma_sync_single_for_cpu(rtwdev->dev, dma, RTW89_PCI_RX_BUF_SIZE,
DMA_FROM_DEVICE);
}
static void rtw89_pci_sync_skb_for_device(struct rtw89_dev *rtwdev,
struct sk_buff *skb)
{
struct rtw89_pci_rx_info *rx_info;
dma_addr_t dma;
rx_info = RTW89_PCI_RX_SKB_CB(skb);
dma = rx_info->dma;
dma_sync_single_for_device(rtwdev->dev, dma, RTW89_PCI_RX_BUF_SIZE,
DMA_FROM_DEVICE);
}
static void rtw89_pci_rxbd_info_update(struct rtw89_dev *rtwdev,
struct sk_buff *skb)
{
struct rtw89_pci_rx_info *rx_info = RTW89_PCI_RX_SKB_CB(skb);
struct rtw89_pci_rxbd_info *rxbd_info;
__le32 info;
rxbd_info = (struct rtw89_pci_rxbd_info *)skb->data;
info = rxbd_info->dword;
rx_info->fs = le32_get_bits(info, RTW89_PCI_RXBD_FS);
rx_info->ls = le32_get_bits(info, RTW89_PCI_RXBD_LS);
rx_info->len = le32_get_bits(info, RTW89_PCI_RXBD_WRITE_SIZE);
rx_info->tag = le32_get_bits(info, RTW89_PCI_RXBD_TAG);
}
static int rtw89_pci_validate_rx_tag(struct rtw89_dev *rtwdev,
Annotation
- Immediate include surface: `linux/pci.h`, `mac.h`, `pci.h`, `reg.h`, `ser.h`.
- Detected declarations: `function rtw89_pci_get_phy_offset_by_link_speed`, `function rtw89_pci_rst_bdram_ax`, `function rtw89_pci_dma_recalc`, `function rtw89_pci_txbd_recalc`, `function rtw89_pci_release_fwcmd`, `function rtw89_pci_reclaim_tx_fwcmd`, `function rtw89_pci_rxbd_recalc`, `function rtw89_pci_sync_skb_for_cpu`, `function rtw89_pci_sync_skb_for_device`, `function rtw89_pci_rxbd_info_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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.