diff options
Diffstat (limited to 'include/scsi/libiscsi.h')
-rw-r--r-- | include/scsi/libiscsi.h | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 61e53f14f7e1..7360e1916e75 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <scsi/iscsi_proto.h> | 31 | #include <scsi/iscsi_proto.h> |
32 | #include <scsi/iscsi_if.h> | 32 | #include <scsi/iscsi_if.h> |
33 | #include <scsi/scsi_transport_iscsi.h> | ||
33 | 34 | ||
34 | struct scsi_transport_template; | 35 | struct scsi_transport_template; |
35 | struct scsi_host_template; | 36 | struct scsi_host_template; |
@@ -70,12 +71,12 @@ enum { | |||
70 | /* Connection suspend "bit" */ | 71 | /* Connection suspend "bit" */ |
71 | #define ISCSI_SUSPEND_BIT 1 | 72 | #define ISCSI_SUSPEND_BIT 1 |
72 | 73 | ||
73 | #define ISCSI_ITT_MASK (0x1fff) | 74 | #define ISCSI_ITT_MASK 0x1fff |
74 | #define ISCSI_TOTAL_CMDS_MAX 4096 | 75 | #define ISCSI_TOTAL_CMDS_MAX 4096 |
75 | /* this must be a power of two greater than ISCSI_MGMT_CMDS_MAX */ | 76 | /* this must be a power of two greater than ISCSI_MGMT_CMDS_MAX */ |
76 | #define ISCSI_TOTAL_CMDS_MIN 16 | 77 | #define ISCSI_TOTAL_CMDS_MIN 16 |
77 | #define ISCSI_AGE_SHIFT 28 | 78 | #define ISCSI_AGE_SHIFT 28 |
78 | #define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) | 79 | #define ISCSI_AGE_MASK 0xf |
79 | 80 | ||
80 | #define ISCSI_ADDRESS_BUF_LEN 64 | 81 | #define ISCSI_ADDRESS_BUF_LEN 64 |
81 | 82 | ||
@@ -93,24 +94,38 @@ enum { | |||
93 | ISCSI_TASK_RUNNING, | 94 | ISCSI_TASK_RUNNING, |
94 | }; | 95 | }; |
95 | 96 | ||
97 | struct iscsi_r2t_info { | ||
98 | __be32 ttt; /* copied from R2T */ | ||
99 | __be32 exp_statsn; /* copied from R2T */ | ||
100 | uint32_t data_length; /* copied from R2T */ | ||
101 | uint32_t data_offset; /* copied from R2T */ | ||
102 | int data_count; /* DATA-Out payload progress */ | ||
103 | int datasn; | ||
104 | /* LLDs should set/update these values */ | ||
105 | int sent; /* R2T sequence progress */ | ||
106 | }; | ||
107 | |||
96 | struct iscsi_task { | 108 | struct iscsi_task { |
97 | /* | 109 | /* |
98 | * Because LLDs allocate their hdr differently, this is a pointer | 110 | * Because LLDs allocate their hdr differently, this is a pointer |
99 | * and length to that storage. It must be setup at session | 111 | * and length to that storage. It must be setup at session |
100 | * creation time. | 112 | * creation time. |
101 | */ | 113 | */ |
102 | struct iscsi_cmd *hdr; | 114 | struct iscsi_hdr *hdr; |
103 | unsigned short hdr_max; | 115 | unsigned short hdr_max; |
104 | unsigned short hdr_len; /* accumulated size of hdr used */ | 116 | unsigned short hdr_len; /* accumulated size of hdr used */ |
117 | /* copied values in case we need to send tmfs */ | ||
118 | itt_t hdr_itt; | ||
119 | __be32 cmdsn; | ||
120 | uint8_t lun[8]; | ||
121 | |||
105 | int itt; /* this ITT */ | 122 | int itt; /* this ITT */ |
106 | 123 | ||
107 | uint32_t unsol_datasn; | ||
108 | unsigned imm_count; /* imm-data (bytes) */ | 124 | unsigned imm_count; /* imm-data (bytes) */ |
109 | unsigned unsol_count; /* unsolicited (bytes)*/ | ||
110 | /* offset in unsolicited stream (bytes); */ | 125 | /* offset in unsolicited stream (bytes); */ |
111 | unsigned unsol_offset; | 126 | struct iscsi_r2t_info unsol_r2t; |
112 | unsigned data_count; /* remaining Data-Out */ | ||
113 | char *data; /* mgmt payload */ | 127 | char *data; /* mgmt payload */ |
128 | unsigned data_count; | ||
114 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ | 129 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ |
115 | struct iscsi_conn *conn; /* used connection */ | 130 | struct iscsi_conn *conn; /* used connection */ |
116 | 131 | ||
@@ -121,6 +136,11 @@ struct iscsi_task { | |||
121 | void *dd_data; /* driver/transport data */ | 136 | void *dd_data; /* driver/transport data */ |
122 | }; | 137 | }; |
123 | 138 | ||
139 | static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) | ||
140 | { | ||
141 | return task->unsol_r2t.data_length > task->unsol_r2t.sent; | ||
142 | } | ||
143 | |||
124 | static inline void* iscsi_next_hdr(struct iscsi_task *task) | 144 | static inline void* iscsi_next_hdr(struct iscsi_task *task) |
125 | { | 145 | { |
126 | return (void*)task->hdr + task->hdr_len; | 146 | return (void*)task->hdr + task->hdr_len; |
@@ -376,8 +396,9 @@ extern void iscsi_suspend_tx(struct iscsi_conn *conn); | |||
376 | * pdu and task processing | 396 | * pdu and task processing |
377 | */ | 397 | */ |
378 | extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); | 398 | extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); |
379 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *, | 399 | extern void iscsi_prep_data_out_pdu(struct iscsi_task *task, |
380 | struct iscsi_data *hdr); | 400 | struct iscsi_r2t_info *r2t, |
401 | struct iscsi_data *hdr); | ||
381 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, | 402 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, |
382 | char *, uint32_t); | 403 | char *, uint32_t); |
383 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | 404 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, |