drivers/infiniband/sw/siw/siw_mem.h
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/siw/siw_mem.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/siw/siw_mem.h- Extension
.h- Size
- 2039 bytes
- Lines
- 69
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function siw_mem_putfunction siw_unref_mem_sglfunction siw_get_upage
Annotated Snippet
#ifndef _SIW_MEM_H
#define _SIW_MEM_H
struct siw_umem *siw_umem_get(struct ib_device *base_dave, u64 start,
u64 len, int rights);
void siw_umem_release(struct siw_umem *umem);
struct siw_pbl *siw_pbl_alloc(u32 num_buf);
dma_addr_t siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx);
struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index);
int siw_invalidate_stag(struct ib_pd *pd, u32 stag);
int siw_check_mem(struct ib_pd *pd, struct siw_mem *mem, u64 addr,
enum ib_access_flags perms, int len);
int siw_check_sge(struct ib_pd *pd, struct siw_sge *sge,
struct siw_mem *mem[], enum ib_access_flags perms,
u32 off, u32 len);
void siw_wqe_put_mem(struct siw_wqe *wqe, enum siw_opcode op);
int siw_mr_add_mem(struct siw_mr *mr, struct ib_pd *pd, void *mem_obj,
u64 start, u64 len, int rights);
void siw_mr_drop_mem(struct siw_mr *mr);
void siw_free_mem(struct kref *ref);
static inline void siw_mem_put(struct siw_mem *mem)
{
kref_put(&mem->ref, siw_free_mem);
}
static inline void siw_unref_mem_sgl(struct siw_mem **mem, unsigned int num_sge)
{
while (num_sge) {
if (*mem == NULL)
break;
siw_mem_put(*mem);
*mem = NULL;
mem++;
num_sge--;
}
}
#define CHUNK_SHIFT 9 /* sets number of pages per chunk */
#define PAGES_PER_CHUNK (_AC(1, UL) << CHUNK_SHIFT)
#define CHUNK_MASK (~(PAGES_PER_CHUNK - 1))
/*
* siw_get_upage()
*
* Get page pointer for address on given umem.
*
* @umem: two dimensional list of page pointers
* @addr: user virtual address
*/
static inline struct page *siw_get_upage(struct siw_umem *umem, u64 addr)
{
unsigned int page_idx = (addr - umem->fp_addr) >> PAGE_SHIFT,
chunk_idx = page_idx >> CHUNK_SHIFT,
page_in_chunk = page_idx & ~CHUNK_MASK;
if (page_idx < umem->num_pages)
return umem->page_chunk[chunk_idx].plist[page_in_chunk];
return NULL;
}
#endif
Annotation
- Detected declarations: `function siw_mem_put`, `function siw_unref_mem_sgl`, `function siw_get_upage`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.