include/scsi/libiscsi.h

Source file repositories/reference/linux-study-clean/include/scsi/libiscsi.h

File Facts

System
Linux kernel
Corpus path
include/scsi/libiscsi.h
Extension
.h
Size
14964 bytes
Lines
515
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

struct iscsi_r2t_info {
	__be32			ttt;		/* copied from R2T */
	__be32			exp_statsn;	/* copied from R2T */
	uint32_t		data_length;	/* copied from R2T */
	uint32_t		data_offset;	/* copied from R2T */
	int			data_count;	/* DATA-Out payload progress */
	int			datasn;
	/* LLDs should set/update these values */
	int			sent;		/* R2T sequence progress */
};

struct iscsi_task {
	/*
	 * Because LLDs allocate their hdr differently, this is a pointer
	 * and length to that storage. It must be setup at session
	 * creation time.
	 */
	struct iscsi_hdr	*hdr;
	unsigned short		hdr_max;
	unsigned short		hdr_len;	/* accumulated size of hdr used */
	/* copied values in case we need to send tmfs */
	itt_t			hdr_itt;
	__be32			cmdsn;
	struct scsi_lun		lun;

	int			itt;		/* this ITT */

	unsigned		imm_count;	/* imm-data (bytes)   */
	/* offset in unsolicited stream (bytes); */
	struct iscsi_r2t_info	unsol_r2t;
	char			*data;		/* mgmt payload */
	unsigned		data_count;
	struct scsi_cmnd	*sc;		/* associated SCSI cmd*/
	struct iscsi_conn	*conn;		/* used connection    */

	/* data processing tracking */
	unsigned long		last_xfer;
	unsigned long		last_timeout;
	bool			have_checked_conn;

	/* T10 protection information */
	bool			protected;

	/* state set/tested under session->lock */
	int			state;
	refcount_t		refcount;
	struct list_head	running;	/* running cmd list */
	void			*dd_data;	/* driver/transport data */
};

static inline int iscsi_task_has_unsol_data(struct iscsi_task *task)
{
	return task->unsol_r2t.data_length > task->unsol_r2t.sent;
}

static inline void* iscsi_next_hdr(struct iscsi_task *task)
{
	return (void*)task->hdr + task->hdr_len;
}

static inline bool iscsi_task_is_completed(struct iscsi_task *task)
{
	return task->state == ISCSI_TASK_COMPLETED ||
	       task->state == ISCSI_TASK_ABRT_TMF ||
	       task->state == ISCSI_TASK_ABRT_SESS_RECOV;
}

/* Private data associated with struct scsi_cmnd. */
struct iscsi_cmd {
	struct iscsi_task	*task;
	int			age;
};

static inline struct iscsi_cmd *iscsi_cmd(struct scsi_cmnd *cmd)
{
	return scsi_cmd_priv(cmd);
}

/* Connection's states */
enum {
	ISCSI_CONN_INITIAL_STAGE,
	ISCSI_CONN_STARTED,
	ISCSI_CONN_STOPPED,
	ISCSI_CONN_CLEANUP_WAIT,
};

struct iscsi_conn {
	struct iscsi_cls_conn	*cls_conn;	/* ptr to class connection */
	void			*dd_data;	/* iscsi_transport data */
	struct iscsi_session	*session;	/* parent session */

Annotation

Implementation Notes