aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libiscsi.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
commit590cf28580c999c8ba70dc39b40bab09d69e2630 (patch)
tree22b9aa4b148bea8a310b760521d1032eef7d743f /include/scsi/libiscsi.h
parentf54a6ec0fd85002d94d05b4bb679508eeb066683 (diff)
parentfb5edd020fa0fbe991f4a473611ad530d2237425 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (104 commits) [SCSI] fcoe: fix configuration problems [SCSI] cxgb3i: fix select/depend problem [SCSI] fcoe: fix incorrect use of struct module [SCSI] cxgb3i: remove use of skb->sp [SCSI] cxgb3i: Add cxgb3i iSCSI driver. [SCSI] zfcp: Remove unnecessary warning message [SCSI] zfcp: Add support for unchained FSF requests [SCSI] zfcp: Remove busid macro [SCSI] zfcp: remove DID_DID flag [SCSI] zfcp: Simplify mask lookups for incoming RSCNs [SCSI] zfcp: Remove initial device data from zfcp_data [SCSI] zfcp: fix compile warning [SCSI] zfcp: Remove adapter list [SCSI] zfcp: Simplify SBAL allocation to fix sparse warnings [SCSI] zfcp: register with SCSI layer on ccw registration [SCSI] zfcp: Fix message line break [SCSI] qla2xxx: changes in multiq code [SCSI] eata: fix the data buffer accessors conversion regression [SCSI] ibmvfc: Improve async event handling [SCSI] lpfc : correct printk types on PPC compiles ...
Diffstat (limited to 'include/scsi/libiscsi.h')
-rw-r--r--include/scsi/libiscsi.h39
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
34struct scsi_transport_template; 35struct scsi_transport_template;
35struct scsi_host_template; 36struct 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
97struct 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
96struct iscsi_task { 108struct 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
139static 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
124static inline void* iscsi_next_hdr(struct iscsi_task *task) 144static 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 */
378extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); 398extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *);
379extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_task *, 399extern 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);
381extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, 402extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
382 char *, uint32_t); 403 char *, uint32_t);
383extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, 404extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,