drivers/infiniband/ulp/srpt/ib_srpt.h

Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/srpt/ib_srpt.h

File Facts

System
Linux kernel
Corpus path
drivers/infiniband/ulp/srpt/ib_srpt.h
Extension
.h
Size
15762 bytes
Lines
470
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 srpt_ioctx {
	struct ib_cqe		cqe;
	void			*buf;
	dma_addr_t		dma;
	uint32_t		offset;
	uint32_t		index;
};

/**
 * struct srpt_recv_ioctx - SRPT receive I/O context
 * @ioctx:     See above.
 * @wait_list: Node for insertion in srpt_rdma_ch.cmd_wait_list.
 * @byte_len:  Number of bytes in @ioctx.buf.
 */
struct srpt_recv_ioctx {
	struct srpt_ioctx	ioctx;
	struct list_head	wait_list;
	int			byte_len;
};

struct srpt_rw_ctx {
	struct rdma_rw_ctx	rw;
	struct scatterlist	*sg;
	unsigned int		nents;
};

/**
 * struct srpt_send_ioctx - SRPT send I/O context
 * @ioctx:       See above.
 * @ch:          Channel pointer.
 * @recv_ioctx:  Receive I/O context associated with this send I/O context.
 *		 Only used for processing immediate data.
 * @s_rw_ctx:    @rw_ctxs points here if only a single rw_ctx is needed.
 * @rw_ctxs:     RDMA read/write contexts.
 * @imm_sg:      Scatterlist for immediate data.
 * @rdma_cqe:    RDMA completion queue element.
 * @state:       I/O context state.
 * @cmd:         Target core command data structure.
 * @sense_data:  SCSI sense data.
 * @n_rdma:      Number of work requests needed to transfer this ioctx.
 * @n_rw_ctx:    Size of rw_ctxs array.
 * @queue_status_only: Send a SCSI status back to the initiator but no data.
 * @sense_data:  Sense data to be sent to the initiator.
 */
struct srpt_send_ioctx {
	struct srpt_ioctx	ioctx;
	struct srpt_rdma_ch	*ch;
	struct srpt_recv_ioctx	*recv_ioctx;

	struct srpt_rw_ctx	s_rw_ctx;
	struct srpt_rw_ctx	*rw_ctxs;

	struct scatterlist	imm_sg;

	struct ib_cqe		rdma_cqe;
	enum srpt_command_state	state;
	struct se_cmd		cmd;
	u8			n_rdma;
	u8			n_rw_ctx;
	bool			queue_status_only;
	u8			sense_data[TRANSPORT_SENSE_BUFFER];
};

/**
 * enum rdma_ch_state - SRP channel state
 * @CH_CONNECTING:    QP is in RTR state; waiting for RTU.
 * @CH_LIVE:	      QP is in RTS state.
 * @CH_DISCONNECTING: DREQ has been sent and waiting for DREP or DREQ has
 *                    been received.
 * @CH_DRAINING:      DREP has been received or waiting for DREP timed out
 *                    and last work request has been queued.
 * @CH_DISCONNECTED:  Last completion has been received.
 */
enum rdma_ch_state {
	CH_CONNECTING,
	CH_LIVE,
	CH_DISCONNECTING,
	CH_DRAINING,
	CH_DISCONNECTED,
};

/**
 * struct srpt_rdma_ch - RDMA channel
 * @nexus:         I_T nexus this channel is associated with.
 * @qp:            IB queue pair used for communicating over this channel.
 * @ib_cm:	   See below.
 * @ib_cm.cm_id:   IB CM ID associated with the channel.
 * @rdma_cm:	   See below.
 * @rdma_cm.cm_id: RDMA CM ID associated with the channel.
 * @cq:            IB completion queue for this channel.

Annotation

Implementation Notes