include/rdma/ib_umem.h
Source file repositories/reference/linux-study-clean/include/rdma/ib_umem.h
File Facts
- System
- Linux kernel
- Corpus path
include/rdma/ib_umem.h- Extension
.h- Size
- 9314 bytes
- Lines
- 303
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/scatterlist.hlinux/err.h
Detected Declarations
struct ib_devicestruct dma_buf_attach_opsstruct ib_umemstruct ib_umem_dmabufstruct ib_udatastruct ib_uverbs_buffer_descstruct uverbs_attr_bundlefunction ib_umem_offsetfunction ib_umem_start_dma_addrfunction ib_umem_dma_offsetfunction ib_umem_num_dma_blocksfunction ib_umem_num_pagesfunction ib_umem_find_best_pgszfunction ib_umem_is_contiguousfunction ib_umem_get_descfunction ib_umem_get_attrfunction ib_umem_get_attr_or_vafunction ib_umem_get_cq_buffunction ib_umem_get_cq_buf_or_vafunction ib_umem_releasefunction ib_umem_find_best_pgszfunction ib_umem_find_best_pgofffunction ib_umem_is_contiguousfunction ib_umem_dmabuf_get_pinnedfunction ib_umem_dmabuf_get_pinned_revocable_and_lockfunction ib_umem_dmabuf_set_revoke_lockedfunction ib_umem_dmabuf_map_pagesfunction ib_umem_dmabuf_unmap_pages
Annotated Snippet
struct ib_umem {
struct ib_device *ibdev;
struct mm_struct *owning_mm;
u64 iova;
size_t length;
unsigned long address;
unsigned long dma_attrs;
u32 writable : 1;
u32 is_odp : 1;
u32 is_dmabuf : 1;
struct sg_append_table sgt_append;
};
struct ib_umem_dmabuf {
struct ib_umem umem;
struct dma_buf_attachment *attach;
struct sg_table *sgt;
struct scatterlist *first_sg;
struct scatterlist *last_sg;
unsigned long first_sg_offset;
unsigned long last_sg_trim;
void (*pinned_revoke)(void *priv);
void *private;
u8 pinned : 1;
u8 revoked : 1;
};
static inline struct ib_umem_dmabuf *to_ib_umem_dmabuf(struct ib_umem *umem)
{
return container_of(umem, struct ib_umem_dmabuf, umem);
}
/* Returns the offset of the umem start relative to the first page. */
static inline int ib_umem_offset(struct ib_umem *umem)
{
return umem->address & ~PAGE_MASK;
}
static inline dma_addr_t ib_umem_start_dma_addr(struct ib_umem *umem)
{
return sg_dma_address(umem->sgt_append.sgt.sgl) + ib_umem_offset(umem);
}
static inline unsigned long ib_umem_dma_offset(struct ib_umem *umem,
unsigned long pgsz)
{
return ib_umem_start_dma_addr(umem) & (pgsz - 1);
}
static inline size_t ib_umem_num_dma_blocks(struct ib_umem *umem,
unsigned long pgsz)
{
return (size_t)((ALIGN(umem->iova + umem->length, pgsz) -
ALIGN_DOWN(umem->iova, pgsz))) /
pgsz;
}
static inline size_t ib_umem_num_pages(struct ib_umem *umem)
{
return ib_umem_num_dma_blocks(umem, PAGE_SIZE);
}
struct ib_udata;
struct ib_uverbs_buffer_desc;
struct uverbs_attr_bundle;
#ifdef CONFIG_INFINIBAND_USER_MEM
struct ib_umem *ib_umem_get_desc(struct ib_device *device,
const struct ib_uverbs_buffer_desc *desc,
int access);
struct ib_umem *ib_umem_get_attr(struct ib_device *device,
const struct uverbs_attr_bundle *attrs,
u16 attr_id, size_t size, int access);
struct ib_umem *ib_umem_get_attr_or_va(struct ib_device *device,
const struct uverbs_attr_bundle *attrs,
u16 attr_id, u64 addr, size_t size,
int access);
struct ib_umem *ib_umem_get_cq_buf(struct ib_device *device,
const struct uverbs_attr_bundle *attrs,
size_t size, int access);
struct ib_umem *ib_umem_get_cq_buf_or_va(struct ib_device *device,
const struct uverbs_attr_bundle *attrs,
u64 addr, size_t size, int access);
static inline struct ib_umem *ib_umem_get_va(struct ib_device *device,
unsigned long addr, size_t size,
int access)
{
return ib_umem_get_attr_or_va(device, NULL, 0, addr, size, access);
Annotation
- Immediate include surface: `linux/scatterlist.h`, `linux/err.h`.
- Detected declarations: `struct ib_device`, `struct dma_buf_attach_ops`, `struct ib_umem`, `struct ib_umem_dmabuf`, `struct ib_udata`, `struct ib_uverbs_buffer_desc`, `struct uverbs_attr_bundle`, `function ib_umem_offset`, `function ib_umem_start_dma_addr`, `function ib_umem_dma_offset`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
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.