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.

Dependency Surface

Detected Declarations

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

Implementation Notes