drivers/infiniband/ulp/srp/ib_srp.h

Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/srp/ib_srp.h

File Facts

System
Linux kernel
Corpus path
drivers/infiniband/ulp/srp/ib_srp.h
Extension
.h
Size
8844 bytes
Lines
351
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 srp_device {
	struct list_head	dev_list;
	struct ib_device       *dev;
	struct ib_pd	       *pd;
	u32			global_rkey;
	u64			mr_page_mask;
	int			mr_page_size;
	int			mr_max_size;
	int			max_pages_per_mr;
	bool			has_fr;
	bool			use_fast_reg;
};

/*
 * One port of an RDMA adapter in the initiator system.
 *
 * @target_list: List of connected target ports (struct srp_target_port).
 * @target_lock: Protects @target_list.
 */
struct srp_host {
	struct srp_device      *srp_dev;
	u32			port;
	struct device		dev;
	struct list_head	target_list;
	spinlock_t		target_lock;
	struct list_head	list;
	struct mutex		add_target_mutex;
};

struct srp_request {
	struct scsi_cmnd       *scmnd;
	struct srp_iu	       *cmd;
	struct srp_fr_desc     **fr_list;
	struct srp_direct_buf  *indirect_desc;
	dma_addr_t		indirect_dma_addr;
	short			nmdesc;
	struct ib_cqe		reg_cqe;
};

/**
 * struct srp_rdma_ch
 * @comp_vector: Completion vector used by this RDMA channel.
 * @max_it_iu_len: Maximum initiator-to-target information unit length.
 * @max_ti_iu_len: Maximum target-to-initiator information unit length.
 */
struct srp_rdma_ch {
	/* These are RW in the hot path, and commonly used together */
	struct list_head	free_tx;
	spinlock_t		lock;
	s32			req_lim;

	/* These are read-only in the hot path */
	struct srp_target_port *target ____cacheline_aligned_in_smp;
	struct ib_cq	       *send_cq;
	struct ib_cq	       *recv_cq;
	struct ib_qp	       *qp;
	struct srp_fr_pool     *fr_pool;
	uint32_t		max_it_iu_len;
	uint32_t		max_ti_iu_len;
	u8			max_imm_sge;
	bool			use_imm_data;

	/* Everything above this point is used in the hot path of
	 * command processing. Try to keep them packed into cachelines.
	 */

	struct completion	done;
	int			status;

	union {
		struct ib_cm {
			struct sa_path_rec	path;
			struct ib_sa_query	*path_query;
			int			path_query_id;
			struct ib_cm_id		*cm_id;
		} ib_cm;
		struct rdma_cm {
			struct rdma_cm_id	*cm_id;
		} rdma_cm;
	};

	struct srp_iu	      **tx_ring;
	struct srp_iu	      **rx_ring;
	int			comp_vector;

	u64			tsk_mgmt_tag;
	struct completion	tsk_mgmt_done;
	u8			tsk_mgmt_status;
	bool			connected;
};

Annotation

Implementation Notes