drivers/infiniband/hw/hns/hns_roce_device.h
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hns/hns_roce_device.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hns/hns_roce_device.h- Extension
.h- Size
- 37016 bytes
- Lines
- 1355
- 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/pci.hrdma/ib_verbs.hrdma/hns-abi.hhns_roce_debugfs.h
Detected Declarations
struct hns_roce_uarstruct hns_user_mmap_entrystruct hns_roce_ucontextstruct hns_roce_pdstruct hns_roce_xrcdstruct hns_roce_bitmapstruct hns_roce_idastruct hns_roce_hem_tablestruct hns_roce_buf_regionstruct hns_roce_hem_liststruct hns_roce_buf_attrstruct hns_roce_hem_cfgstruct hns_roce_mtrstruct hns_roce_mrstruct hns_roce_mr_tablestruct hns_roce_wqstruct hns_roce_sgestruct hns_roce_buf_liststruct hns_roce_bufstruct hns_roce_db_pgdirstruct hns_roce_user_db_pagestruct hns_roce_dbstruct hns_roce_cqstruct hns_roce_idx_questruct hns_roce_srqstruct hns_roce_uar_tablestruct hns_roce_bankstruct hns_roce_qp_tablestruct hns_roce_cq_tablestruct hns_roce_srq_tablestruct hns_roce_avstruct hns_roce_ahstruct hns_roce_cmd_contextstruct hns_roce_cmdqstruct hns_roce_cmd_mailboxstruct hns_roce_mbox_msgstruct hns_roce_devstruct hns_roce_workstruct hns_roce_qpstruct hns_roce_ib_iboestruct hns_roce_ceqestruct hns_roce_aeqestruct hns_roce_eqstruct hns_roce_eq_tablestruct hns_roce_capsstruct hns_roce_hwstruct hns_roce_scc_paramstruct hns_roce_dev
Annotated Snippet
struct hns_roce_uar {
u64 pfn;
unsigned long index;
unsigned long logic_idx;
};
enum hns_roce_mmap_type {
HNS_ROCE_MMAP_TYPE_DB = 1,
HNS_ROCE_MMAP_TYPE_DWQE,
};
struct hns_user_mmap_entry {
struct rdma_user_mmap_entry rdma_entry;
enum hns_roce_mmap_type mmap_type;
u64 address;
};
struct hns_roce_ucontext {
struct ib_ucontext ibucontext;
struct hns_roce_uar uar;
struct list_head page_list;
struct mutex page_mutex;
struct hns_user_mmap_entry *db_mmap_entry;
u32 config;
u8 cq_bank_id;
};
struct hns_roce_pd {
struct ib_pd ibpd;
unsigned long pdn;
};
struct hns_roce_xrcd {
struct ib_xrcd ibxrcd;
u32 xrcdn;
};
struct hns_roce_bitmap {
/* Bitmap Traversal last a bit which is 1 */
unsigned long last;
unsigned long top;
unsigned long max;
unsigned long reserved_top;
unsigned long mask;
spinlock_t lock;
unsigned long *table;
};
struct hns_roce_ida {
struct ida ida;
u32 min; /* Lowest ID to allocate. */
u32 max; /* Highest ID to allocate. */
};
/* For Hardware Entry Memory */
struct hns_roce_hem_table {
/* HEM type: 0 = qpc, 1 = mtt, 2 = cqc, 3 = srq, 4 = other */
u32 type;
/* HEM array elment num */
unsigned long num_hem;
/* Single obj size */
unsigned long obj_size;
unsigned long table_chunk_size;
struct mutex mutex;
struct hns_roce_hem **hem;
u64 **bt_l1;
dma_addr_t *bt_l1_dma_addr;
u64 **bt_l0;
dma_addr_t *bt_l0_dma_addr;
};
struct hns_roce_buf_region {
u32 offset; /* page offset */
u32 count; /* page count */
int hopnum; /* addressing hop num */
};
#define HNS_ROCE_MAX_BT_REGION 3
#define HNS_ROCE_MAX_BT_LEVEL 3
struct hns_roce_hem_list {
struct list_head root_bt;
/* link all bt dma mem by hop config */
struct list_head mid_bt[HNS_ROCE_MAX_BT_REGION][HNS_ROCE_MAX_BT_LEVEL];
struct list_head btm_bt; /* link all bottom bt in @mid_bt */
dma_addr_t root_ba; /* pointer to the root ba table */
};
enum mtr_type {
MTR_DEFAULT = 0,
MTR_PBL,
Annotation
- Immediate include surface: `linux/pci.h`, `rdma/ib_verbs.h`, `rdma/hns-abi.h`, `hns_roce_debugfs.h`.
- Detected declarations: `struct hns_roce_uar`, `struct hns_user_mmap_entry`, `struct hns_roce_ucontext`, `struct hns_roce_pd`, `struct hns_roce_xrcd`, `struct hns_roce_bitmap`, `struct hns_roce_ida`, `struct hns_roce_hem_table`, `struct hns_roce_buf_region`, `struct hns_roce_hem_list`.
- 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.