diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-12-02 01:32:05 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:20 -0500 |
commit | 577577da6d197ea3dcf3ee19c4f902fbd3a9390a (patch) | |
tree | 624b991f45dc12da557469daed0deea2bffb47ac /include/scsi | |
parent | 63c62f1cb980241513c82cacd5b9f878527c6647 (diff) |
[SCSI] libiscsi: prepare libiscsi for new offload engines by modifying unsol data code
cxgb3i offloads data transfers. It does not offload the entire scsi/iscsi
procssing like qla4xxx and it does not offload the iscsi sequence
processing like how bnx2i does. cxgb3i relies on iscsi_tcp for the
seqeunce handling so this changes how we transfer unsolicitied data by
adding a common r2t struct and helpers.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libiscsi.h | 34 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 9 |
2 files changed, 34 insertions, 9 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 61e53f14f7e1..51500573c0b8 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -93,24 +93,38 @@ enum { | |||
93 | ISCSI_TASK_RUNNING, | 93 | ISCSI_TASK_RUNNING, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | struct iscsi_r2t_info { | ||
97 | __be32 ttt; /* copied from R2T */ | ||
98 | __be32 exp_statsn; /* copied from R2T */ | ||
99 | uint32_t data_length; /* copied from R2T */ | ||
100 | uint32_t data_offset; /* copied from R2T */ | ||
101 | int data_count; /* DATA-Out payload progress */ | ||
102 | int datasn; | ||
103 | /* LLDs should set/update these values */ | ||
104 | int sent; /* R2T sequence progress */ | ||
105 | }; | ||
106 | |||
96 | struct iscsi_task { | 107 | struct iscsi_task { |
97 | /* | 108 | /* |
98 | * Because LLDs allocate their hdr differently, this is a pointer | 109 | * Because LLDs allocate their hdr differently, this is a pointer |
99 | * and length to that storage. It must be setup at session | 110 | * and length to that storage. It must be setup at session |
100 | * creation time. | 111 | * creation time. |
101 | */ | 112 | */ |
102 | struct iscsi_cmd *hdr; | 113 | struct iscsi_hdr *hdr; |
103 | unsigned short hdr_max; | 114 | unsigned short hdr_max; |
104 | unsigned short hdr_len; /* accumulated size of hdr used */ | 115 | unsigned short hdr_len; /* accumulated size of hdr used */ |
116 | /* copied values in case we need to send tmfs */ | ||
117 | itt_t hdr_itt; | ||
118 | __be32 cmdsn; | ||
119 | uint8_t lun[8]; | ||
120 | |||
105 | int itt; /* this ITT */ | 121 | int itt; /* this ITT */ |
106 | 122 | ||
107 | uint32_t unsol_datasn; | ||
108 | unsigned imm_count; /* imm-data (bytes) */ | 123 | unsigned imm_count; /* imm-data (bytes) */ |
109 | unsigned unsol_count; /* unsolicited (bytes)*/ | ||
110 | /* offset in unsolicited stream (bytes); */ | 124 | /* offset in unsolicited stream (bytes); */ |
111 | unsigned unsol_offset; | 125 | struct iscsi_r2t_info unsol_r2t; |
112 | unsigned data_count; /* remaining Data-Out */ | ||
113 | char *data; /* mgmt payload */ | 126 | char *data; /* mgmt payload */ |
127 | unsigned data_count; | ||
114 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ | 128 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ |
115 | struct iscsi_conn *conn; /* used connection */ | 129 | struct iscsi_conn *conn; /* used connection */ |
116 | 130 | ||
@@ -121,6 +135,11 @@ struct iscsi_task { | |||
121 | void *dd_data; /* driver/transport data */ | 135 | void *dd_data; /* driver/transport data */ |
122 | }; | 136 | }; |
123 | 137 | ||
138 | static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) | ||
139 | { | ||
140 | return task->unsol_r2t.data_length > task->unsol_r2t.sent; | ||
141 | } | ||
142 | |||
124 | static inline void* iscsi_next_hdr(struct iscsi_task *task) | 143 | static inline void* iscsi_next_hdr(struct iscsi_task *task) |
125 | { | 144 | { |
126 | return (void*)task->hdr + task->hdr_len; | 145 | return (void*)task->hdr + task->hdr_len; |
@@ -376,8 +395,9 @@ extern void iscsi_suspend_tx(struct iscsi_conn *conn); | |||
376 | * pdu and task processing | 395 | * pdu and task processing |
377 | */ | 396 | */ |
378 | extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); | 397 | extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); |
379 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *, | 398 | extern void iscsi_prep_data_out_pdu(struct iscsi_task *task, |
380 | struct iscsi_data *hdr); | 399 | struct iscsi_r2t_info *r2t, |
400 | struct iscsi_data *hdr); | ||
381 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, | 401 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, |
382 | char *, uint32_t); | 402 | char *, uint32_t); |
383 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | 403 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index c667cc396545..c928234c018f 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -113,10 +113,15 @@ struct iscsi_transport { | |||
113 | char *data, uint32_t data_size); | 113 | char *data, uint32_t data_size); |
114 | void (*get_stats) (struct iscsi_cls_conn *conn, | 114 | void (*get_stats) (struct iscsi_cls_conn *conn, |
115 | struct iscsi_stats *stats); | 115 | struct iscsi_stats *stats); |
116 | |||
116 | int (*init_task) (struct iscsi_task *task); | 117 | int (*init_task) (struct iscsi_task *task); |
117 | int (*xmit_task) (struct iscsi_task *task); | 118 | int (*xmit_task) (struct iscsi_task *task); |
118 | void (*cleanup_task) (struct iscsi_conn *conn, | 119 | void (*cleanup_task) (struct iscsi_task *task); |
119 | struct iscsi_task *task); | 120 | |
121 | int (*alloc_pdu) (struct iscsi_task *task); | ||
122 | int (*xmit_pdu) (struct iscsi_task *task); | ||
123 | int (*init_pdu) (struct iscsi_task *task, unsigned int offset, | ||
124 | unsigned int count); | ||
120 | void (*session_recovery_timedout) (struct iscsi_cls_session *session); | 125 | void (*session_recovery_timedout) (struct iscsi_cls_session *session); |
121 | struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr, | 126 | struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr, |
122 | int non_blocking); | 127 | int non_blocking); |