drivers/infiniband/sw/siw/siw_qp_rx.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/siw/siw_qp_rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/siw/siw_qp_rx.c- Extension
.c- Size
- 37975 bytes
- Lines
- 1481
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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/errno.hlinux/types.hlinux/net.hlinux/scatterlist.hlinux/highmem.hrdma/iw_cm.hrdma/ib_verbs.hsiw.hsiw_verbs.hsiw_mem.h
Detected Declarations
function siw_rx_umemfunction siw_rx_kvafunction siw_rx_pblfunction siw_rresp_check_ntohfunction siw_write_check_ntohfunction siw_send_check_ntohfunction siw_rx_datafunction sendsfunction WRITEsfunction siw_proc_rreqfunction contextfunction siw_orqe_start_rxfunction siw_proc_rrespfunction siw_update_skb_rcvdfunction siw_proc_terminatefunction siw_get_trailerfunction siw_get_hdrfunction siw_check_memfunction segmentsfunction siw_check_tx_fencefunction siw_rdmap_completefunction rx_typefunction contextfunction siw_tcp_rx_data
Annotated Snippet
if (unlikely(!p)) {
pr_warn("siw: %s: [QP %u]: bogus addr: %p, %p\n",
__func__, qp_id(rx_qp(srx)),
(void *)(uintptr_t)dest_addr,
(void *)(uintptr_t)umem->fp_addr);
/* siw internal error */
srx->skb_copied += copied;
srx->skb_new -= copied;
return -EFAULT;
}
pg_off = dest_addr & ~PAGE_MASK;
bytes = min(len, (int)PAGE_SIZE - pg_off);
siw_dbg_qp(rx_qp(srx), "page %p, bytes=%u\n", p, bytes);
dest = kmap_atomic(p);
rv = skb_copy_bits(srx->skb, srx->skb_offset, dest + pg_off,
bytes);
if (unlikely(rv)) {
kunmap_atomic(dest);
srx->skb_copied += copied;
srx->skb_new -= copied;
pr_warn("siw: [QP %u]: %s, len %d, page %p, rv %d\n",
qp_id(rx_qp(srx)), __func__, len, p, rv);
return -EFAULT;
}
if (srx->mpa_crc_enabled) {
if (rdma_is_kernel_res(&rx_qp(srx)->base_qp.res)) {
siw_crc_update(&srx->mpa_crc, dest + pg_off,
bytes);
kunmap_atomic(dest);
} else {
kunmap_atomic(dest);
/*
* Do CRC on original, not target buffer.
* Some user land applications may
* concurrently write the target buffer,
* which would yield a broken CRC.
* Walking the skb twice is very ineffcient.
* Folding the CRC into skb_copy_bits()
* would be much better, but is currently
* not supported.
*/
siw_crc_skb(srx, bytes);
}
} else {
kunmap_atomic(dest);
}
srx->skb_offset += bytes;
copied += bytes;
len -= bytes;
dest_addr += bytes;
pg_off = 0;
}
srx->skb_copied += copied;
srx->skb_new -= copied;
return copied;
}
static int siw_rx_kva(struct siw_rx_stream *srx, void *kva, int len)
{
int rv;
siw_dbg_qp(rx_qp(srx), "kva: 0x%p, len: %u\n", kva, len);
rv = skb_copy_bits(srx->skb, srx->skb_offset, kva, len);
if (unlikely(rv)) {
pr_warn("siw: [QP %u]: %s, len %d, kva 0x%p, rv %d\n",
qp_id(rx_qp(srx)), __func__, len, kva, rv);
return rv;
}
if (srx->mpa_crc_enabled)
siw_crc_update(&srx->mpa_crc, kva, len);
srx->skb_offset += len;
srx->skb_copied += len;
srx->skb_new -= len;
return len;
}
static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx,
struct siw_mem *mem, u64 addr, int len)
{
Annotation
- Immediate include surface: `linux/errno.h`, `linux/types.h`, `linux/net.h`, `linux/scatterlist.h`, `linux/highmem.h`, `rdma/iw_cm.h`, `rdma/ib_verbs.h`, `siw.h`.
- Detected declarations: `function siw_rx_umem`, `function siw_rx_kva`, `function siw_rx_pbl`, `function siw_rresp_check_ntoh`, `function siw_write_check_ntoh`, `function siw_send_check_ntoh`, `function siw_rx_data`, `function sends`, `function WRITEs`, `function siw_proc_rreq`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.