drivers/infiniband/hw/hfi1/hfi.h
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/hfi.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/hfi.h- Extension
.h- Size
- 76379 bytes
- Lines
- 2613
- 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.
- 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/refcount.hlinux/interrupt.hlinux/pci.hlinux/dma-mapping.hlinux/mutex.hlinux/list.hlinux/scatterlist.hlinux/slab.hlinux/io.hlinux/fs.hlinux/completion.hlinux/kref.hlinux/sched.hlinux/cdev.hlinux/delay.hlinux/kthread.hlinux/i2c.hlinux/i2c-algo-bit.hlinux/xarray.hrdma/ib_hdrs.hrdma/opa_addr.hlinux/rhashtable.hrdma/rdma_vt.hchip_registers.hcommon.hopfn.hverbs.hpio.hchip.hmad.hqsfp.hplatform.h
Detected Declarations
struct hfi1_ib_statsstruct hfi1_opcode_stats_perctxstruct ctxt_eager_bufsstruct eager_bufferstruct exp_tid_setstruct hfi1_ctxtdatastruct tid_queuestruct hfi1_ctxtdatastruct hfi1_packetstruct rvt_sge_statestruct hfi1_msix_entrystruct hfi1_msix_infostruct cca_timerstruct link_down_reasonstruct vl_arb_cachestruct hfi1_pportdatastruct rcv_array_datastruct per_vl_datastruct err_info_rcvportstruct err_info_constraintstruct hfi1_tempstruct hfi1_i2c_busstruct hfi1_asic_datastruct sdma_enginestruct sdma_vl_mapstruct hfi1_netdev_rxstruct hfi1_devdatastruct tid_rb_nodestruct hfi1_filedatafunction rcvhdrq_sizefunction hfi1_16B_get_l4function hfi1_16B_get_scfunction hfi1_16B_get_dlidfunction hfi1_16B_get_slidfunction hfi1_16B_get_becnfunction hfi1_16B_get_fecnfunction hfi1_16B_get_l2function hfi1_16B_get_pkeyfunction hfi1_16B_get_rcfunction hfi1_16B_get_agefunction hfi1_16B_get_lenfunction hfi1_16B_get_entropyfunction hfi1_16B_bth_get_padfunction hfi1_16B_get_dest_qpnfunction hfi1_16B_get_src_qpnfunction hfi1_16B_set_qpnfunction hfi1_get_rc_ohdrfunction incr_cntr64
Annotated Snippet
struct hfi1_ib_stats {
__u64 sps_ints; /* number of interrupts handled */
__u64 sps_errints; /* number of error interrupts */
__u64 sps_txerrs; /* tx-related packet errors */
__u64 sps_rcverrs; /* non-crc rcv packet errors */
__u64 sps_hwerrs; /* hardware errors reported (parity, etc.) */
__u64 sps_nopiobufs; /* no pio bufs avail from kernel */
__u64 sps_ctxts; /* number of contexts currently open */
__u64 sps_lenerrs; /* number of kernel packets where RHF != LRH len */
__u64 sps_buffull;
__u64 sps_hdrfull;
};
extern struct hfi1_ib_stats hfi1_stats;
extern const struct pci_error_handlers hfi1_pci_err_handler;
extern int num_driver_cntrs;
/*
* First-cut criterion for "device is active" is
* two thousand dwords combined Tx, Rx traffic per
* 5-second interval. SMA packets are 64 dwords,
* and occur "a few per second", presumably each way.
*/
#define HFI1_TRAFFIC_ACTIVE_THRESHOLD (2000)
/*
* Below contains all data related to a single context (formerly called port).
*/
struct hfi1_opcode_stats_perctx;
struct ctxt_eager_bufs {
struct eager_buffer {
void *addr;
dma_addr_t dma;
ssize_t len;
} *buffers;
struct {
void *addr;
dma_addr_t dma;
} *rcvtids;
u32 size; /* total size of eager buffers */
u32 rcvtid_size; /* size of each eager rcv tid */
u16 count; /* size of buffers array */
u16 numbufs; /* number of buffers allocated */
u16 alloced; /* number of rcvarray entries used */
u16 threshold; /* head update threshold */
};
struct exp_tid_set {
struct list_head list;
u32 count;
};
struct hfi1_ctxtdata;
typedef int (*intr_handler)(struct hfi1_ctxtdata *rcd, int data);
typedef void (*rhf_rcv_function_ptr)(struct hfi1_packet *packet);
struct tid_queue {
struct list_head queue_head;
/* queue head for QP TID resource waiters */
u32 enqueue; /* count of tid enqueues */
u32 dequeue; /* count of tid dequeues */
};
struct hfi1_ctxtdata {
/* rcvhdrq base, needs mmap before useful */
void *rcvhdrq;
/* kernel virtual address where hdrqtail is updated */
volatile __le64 *rcvhdrtail_kvaddr;
/* so functions that need physical port can get it easily */
struct hfi1_pportdata *ppd;
/* so file ops can get at unit */
struct hfi1_devdata *dd;
/* this receive context's assigned PIO ACK send context */
struct send_context *sc;
/* per context recv functions */
const rhf_rcv_function_ptr *rhf_rcv_function_map;
/*
* The interrupt handler for a particular receive context can vary
* throughout it's lifetime. This is not a lock protected data member so
* it must be updated atomically and the prev and new value must always
* be valid. Worst case is we process an extra interrupt and up to 64
* packets with the wrong interrupt handler.
*/
intr_handler do_interrupt;
/** fast handler after autoactive */
intr_handler fast_handler;
/** slow handler */
Annotation
- Immediate include surface: `linux/refcount.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/dma-mapping.h`, `linux/mutex.h`, `linux/list.h`, `linux/scatterlist.h`, `linux/slab.h`.
- Detected declarations: `struct hfi1_ib_stats`, `struct hfi1_opcode_stats_perctx`, `struct ctxt_eager_bufs`, `struct eager_buffer`, `struct exp_tid_set`, `struct hfi1_ctxtdata`, `struct tid_queue`, `struct hfi1_ctxtdata`, `struct hfi1_packet`, `struct rvt_sge_state`.
- 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.
- 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.