aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.h
diff options
context:
space:
mode:
authorOlaf Kirch <olaf.kirch@oracle.com>2007-12-13 13:43:35 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:28:42 -0500
commita8ac6311cc21d78fa284cd43f56df2063f536bf1 (patch)
treec408dcccab2854dd9dd1775b5971ea60b34127dd /drivers/scsi/iscsi_tcp.h
parent1040c99d9fd9de2bf00efae6d91014f890575bdb (diff)
[SCSI] iscsi: convert xmit path to iscsi chunks
Convert xmit to iscsi chunks. from michaelc@cs.wisc.edu: Bug fixes, more digest integration, sg chaining conversion and other sg wrapper changes, coding style sync up, and removal of io fields, like pdu_sent, that are not needed. Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.h')
-rw-r--r--drivers/scsi/iscsi_tcp.h75
1 files changed, 15 insertions, 60 deletions
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index d49d87611e82..893cd2e1701e 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -24,35 +24,18 @@
24 24
25#include <scsi/libiscsi.h> 25#include <scsi/libiscsi.h>
26 26
27/* xmit state machine */
28#define XMSTATE_IDLE 0x0
29#define XMSTATE_CMD_HDR_INIT 0x1
30#define XMSTATE_CMD_HDR_XMIT 0x2
31#define XMSTATE_IMM_HDR 0x4
32#define XMSTATE_IMM_DATA 0x8
33#define XMSTATE_UNS_INIT 0x10
34#define XMSTATE_UNS_HDR 0x20
35#define XMSTATE_UNS_DATA 0x40
36#define XMSTATE_SOL_HDR 0x80
37#define XMSTATE_SOL_DATA 0x100
38#define XMSTATE_W_PAD 0x200
39#define XMSTATE_W_RESEND_PAD 0x400
40#define XMSTATE_W_RESEND_DATA_DIGEST 0x800
41#define XMSTATE_IMM_HDR_INIT 0x1000
42#define XMSTATE_SOL_HDR_INIT 0x2000
43
44#define ISCSI_SG_TABLESIZE SG_ALL 27#define ISCSI_SG_TABLESIZE SG_ALL
45#define ISCSI_TCP_MAX_CMD_LEN 16 28#define ISCSI_TCP_MAX_CMD_LEN 16
46 29
47struct crypto_hash; 30struct crypto_hash;
48struct socket; 31struct socket;
49struct iscsi_tcp_conn; 32struct iscsi_tcp_conn;
50struct iscsi_chunk; 33struct iscsi_segment;
51 34
52typedef int iscsi_chunk_done_fn_t(struct iscsi_tcp_conn *, 35typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *,
53 struct iscsi_chunk *); 36 struct iscsi_segment *);
54 37
55struct iscsi_chunk { 38struct iscsi_segment {
56 unsigned char *data; 39 unsigned char *data;
57 unsigned int size; 40 unsigned int size;
58 unsigned int copied; 41 unsigned int copied;
@@ -67,16 +50,14 @@ struct iscsi_chunk {
67 struct scatterlist *sg; 50 struct scatterlist *sg;
68 void *sg_mapped; 51 void *sg_mapped;
69 unsigned int sg_offset; 52 unsigned int sg_offset;
70 unsigned int sg_index;
71 unsigned int sg_count;
72 53
73 iscsi_chunk_done_fn_t *done; 54 iscsi_segment_done_fn_t *done;
74}; 55};
75 56
76/* Socket connection recieve helper */ 57/* Socket connection recieve helper */
77struct iscsi_tcp_recv { 58struct iscsi_tcp_recv {
78 struct iscsi_hdr *hdr; 59 struct iscsi_hdr *hdr;
79 struct iscsi_chunk chunk; 60 struct iscsi_segment segment;
80 61
81 /* Allocate buffer for BHS + AHS */ 62 /* Allocate buffer for BHS + AHS */
82 uint32_t hdr_buf[64]; 63 uint32_t hdr_buf[64];
@@ -88,11 +69,8 @@ struct iscsi_tcp_recv {
88/* Socket connection send helper */ 69/* Socket connection send helper */
89struct iscsi_tcp_send { 70struct iscsi_tcp_send {
90 struct iscsi_hdr *hdr; 71 struct iscsi_hdr *hdr;
91 struct iscsi_chunk chunk; 72 struct iscsi_segment segment;
92 struct iscsi_chunk data_chunk; 73 struct iscsi_segment data_segment;
93
94 /* Allocate buffer for BHS + AHS */
95 uint32_t hdr_buf[64];
96}; 74};
97 75
98struct iscsi_tcp_conn { 76struct iscsi_tcp_conn {
@@ -118,29 +96,19 @@ struct iscsi_tcp_conn {
118 uint32_t sendpage_failures_cnt; 96 uint32_t sendpage_failures_cnt;
119 uint32_t discontiguous_hdr_cnt; 97 uint32_t discontiguous_hdr_cnt;
120 98
121 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); 99 int error;
122};
123 100
124struct iscsi_buf { 101 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
125 struct scatterlist sg;
126 unsigned int sent;
127 char use_sendmsg;
128}; 102};
129 103
130struct iscsi_data_task { 104struct iscsi_data_task {
131 struct iscsi_data hdr; /* PDU */ 105 struct iscsi_data hdr; /* PDU */
132 char hdrext[ISCSI_DIGEST_SIZE];/* Header-Digest */ 106 char hdrext[ISCSI_DIGEST_SIZE];/* Header-Digest */
133 struct iscsi_buf digestbuf; /* digest buffer */
134 uint32_t digest; /* data digest */
135}; 107};
136 108
137struct iscsi_tcp_mgmt_task { 109struct iscsi_tcp_mgmt_task {
138 struct iscsi_hdr hdr; 110 struct iscsi_hdr hdr;
139 char hdrext[ISCSI_DIGEST_SIZE]; /* Header-Digest */ 111 char hdrext[ISCSI_DIGEST_SIZE]; /* Header-Digest */
140 int xmstate; /* mgmt xmit progress */
141 struct iscsi_buf headbuf; /* header buffer */
142 struct iscsi_buf sendbuf; /* in progress buffer */
143 int sent;
144}; 112};
145 113
146struct iscsi_r2t_info { 114struct iscsi_r2t_info {
@@ -148,13 +116,10 @@ struct iscsi_r2t_info {
148 __be32 exp_statsn; /* copied from R2T */ 116 __be32 exp_statsn; /* copied from R2T */
149 uint32_t data_length; /* copied from R2T */ 117 uint32_t data_length; /* copied from R2T */
150 uint32_t data_offset; /* copied from R2T */ 118 uint32_t data_offset; /* copied from R2T */
151 struct iscsi_buf headbuf; /* Data-Out Header Buffer */
152 struct iscsi_buf sendbuf; /* Data-Out in progress buffer*/
153 int sent; /* R2T sequence progress */ 119 int sent; /* R2T sequence progress */
154 int data_count; /* DATA-Out payload progress */ 120 int data_count; /* DATA-Out payload progress */
155 struct scatterlist *sg; /* per-R2T SG list */
156 int solicit_datasn; 121 int solicit_datasn;
157 struct iscsi_data_task dtask; /* which data task */ 122 struct iscsi_data_task dtask; /* Data-Out header buf */
158}; 123};
159 124
160struct iscsi_tcp_cmd_task { 125struct iscsi_tcp_cmd_task {
@@ -163,24 +128,14 @@ struct iscsi_tcp_cmd_task {
163 char hdrextbuf[ISCSI_MAX_AHS_SIZE + 128 char hdrextbuf[ISCSI_MAX_AHS_SIZE +
164 ISCSI_DIGEST_SIZE]; 129 ISCSI_DIGEST_SIZE];
165 } hdr; 130 } hdr;
166 char pad[ISCSI_PAD_LEN]; 131
167 int pad_count; /* padded bytes */
168 struct iscsi_buf headbuf; /* header buf (xmit) */
169 struct iscsi_buf sendbuf; /* in progress buffer*/
170 int xmstate; /* xmit xtate machine */
171 int sent; 132 int sent;
172 struct scatterlist *sg; /* per-cmd SG list */ 133 uint32_t exp_datasn; /* expected target's R2TSN/DataSN */
173 struct scatterlist *bad_sg; /* assert statement */
174 int sg_count; /* SG's to process */
175 uint32_t exp_datasn; /* expected target's R2TSN/DataSN */
176 int data_offset; 134 int data_offset;
177 struct iscsi_r2t_info *r2t; /* in progress R2T */ 135 struct iscsi_r2t_info *r2t; /* in progress R2T */
178 struct iscsi_pool r2tpool; 136 struct iscsi_pool r2tpool;
179 struct kfifo *r2tqueue; 137 struct kfifo *r2tqueue;
180 int digest_count; 138 struct iscsi_data_task unsol_dtask; /* Data-Out header buf */
181 uint32_t immdigest; /* for imm data */
182 struct iscsi_buf immbuf; /* for imm data digest */
183 struct iscsi_data_task unsol_dtask; /* unsol data task */
184}; 139};
185 140
186#endif /* ISCSI_H */ 141#endif /* ISCSI_H */