drivers/net/wireless/realtek/rtw88/pci.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw88/pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw88/pci.c- Extension
.c- Size
- 50478 bytes
- Lines
- 1929
- 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/dmi.hlinux/module.hlinux/pci.hmain.hpci.hreg.htx.hrx.hfw.hps.hdebug.hmac.h
Detected Declarations
function rtw_pci_get_tx_qselfunction rtw_pci_read8function rtw_pci_read16function rtw_pci_read32function rtw_pci_write8function rtw_pci_write16function rtw_pci_write32function rtw_pci_free_tx_ring_skbsfunction rtw_pci_free_tx_ringfunction rtw_pci_free_rx_ring_skbsfunction rtw_pci_free_rx_ringfunction rtw_pci_free_trx_ringfunction rtw_pci_init_tx_ringfunction rtw_pci_reset_rx_descfunction rtw_pci_sync_rx_desc_devicefunction rtw_pci_init_rx_ringfunction rtw_pci_init_trx_ringfunction rtw_pci_deinitfunction rtw_pci_initfunction rtw_pci_reset_buf_descfunction rtw_pci_reset_trx_ringfunction rtw_pci_enable_interruptfunction rtw_pci_disable_interruptfunction rtw_pci_dma_resetfunction rtw_pci_setupfunction rtw_pci_dma_releasefunction rtw_pci_napi_startfunction rtw_pci_napi_stopfunction rtw_pci_startfunction rtw_pci_stopfunction rtw_pci_deep_ps_enterfunction rtw_pci_deep_ps_leavefunction rtw_pci_deep_psfunction rtw_pci_release_rsvd_pagefunction rtw_pci_dma_checkfunction __pci_get_hw_tx_ring_rpfunction __pci_flush_queuefunction __rtw_pci_flush_queuesfunction rtw_pci_flush_queuesfunction rtw_pci_tx_kick_off_queuefunction rtw_pci_tx_kick_offfunction rtw_pci_tx_write_datafunction rtw_pci_write_data_rsvd_pagefunction rtw_pci_write_data_h2cfunction rtw_pci_tx_writefunction rtw_pci_tx_isrfunction rtw_pci_rx_isrfunction rtw_pci_get_hw_rx_ring_nr
Annotated Snippet
if (!skb) {
allocated = i;
ret = -ENOMEM;
goto err_out;
}
memset(skb->data, 0, buf_sz);
rx_ring->buf[i] = skb;
ret = rtw_pci_reset_rx_desc(rtwdev, skb, rx_ring, i, desc_size);
if (ret) {
allocated = i;
dev_kfree_skb_any(skb);
goto err_out;
}
}
rx_ring->r.dma = dma;
rx_ring->r.len = len;
rx_ring->r.desc_size = desc_size;
rx_ring->r.wp = 0;
rx_ring->r.rp = 0;
return 0;
err_out:
for (i = 0; i < allocated; i++) {
skb = rx_ring->buf[i];
if (!skb)
continue;
dma = *((dma_addr_t *)skb->cb);
dma_unmap_single(&pdev->dev, dma, buf_sz, DMA_FROM_DEVICE);
dev_kfree_skb_any(skb);
rx_ring->buf[i] = NULL;
}
dma_free_coherent(&pdev->dev, ring_sz, head, dma);
rtw_err(rtwdev, "failed to init rx buffer\n");
return ret;
}
static int rtw_pci_init_trx_ring(struct rtw_dev *rtwdev)
{
struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
struct rtw_pci_tx_ring *tx_ring;
struct rtw_pci_rx_ring *rx_ring;
const struct rtw_chip_info *chip = rtwdev->chip;
int i = 0, j = 0, tx_alloced = 0, rx_alloced = 0;
int tx_desc_size, rx_desc_size;
u32 len;
int ret;
tx_desc_size = chip->tx_buf_desc_sz;
for (i = 0; i < RTK_MAX_TX_QUEUE_NUM; i++) {
tx_ring = &rtwpci->tx_rings[i];
len = max_num_of_tx_queue(i);
ret = rtw_pci_init_tx_ring(rtwdev, tx_ring, tx_desc_size, len);
if (ret)
goto out;
}
rx_desc_size = chip->rx_buf_desc_sz;
for (j = 0; j < RTK_MAX_RX_QUEUE_NUM; j++) {
rx_ring = &rtwpci->rx_rings[j];
ret = rtw_pci_init_rx_ring(rtwdev, rx_ring, rx_desc_size,
RTK_MAX_RX_DESC_NUM);
if (ret)
goto out;
}
return 0;
out:
tx_alloced = i;
for (i = 0; i < tx_alloced; i++) {
tx_ring = &rtwpci->tx_rings[i];
rtw_pci_free_tx_ring(rtwdev, tx_ring);
}
rx_alloced = j;
for (j = 0; j < rx_alloced; j++) {
rx_ring = &rtwpci->rx_rings[j];
rtw_pci_free_rx_ring(rtwdev, rx_ring);
}
return ret;
}
Annotation
- Immediate include surface: `linux/dmi.h`, `linux/module.h`, `linux/pci.h`, `main.h`, `pci.h`, `reg.h`, `tx.h`, `rx.h`.
- Detected declarations: `function rtw_pci_get_tx_qsel`, `function rtw_pci_read8`, `function rtw_pci_read16`, `function rtw_pci_read32`, `function rtw_pci_write8`, `function rtw_pci_write16`, `function rtw_pci_write32`, `function rtw_pci_free_tx_ring_skbs`, `function rtw_pci_free_tx_ring`, `function rtw_pci_free_rx_ring_skbs`.
- 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.