aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
commit9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch)
tree4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/scsi/iscsi_tcp.h
parent50d9a126240f9961cfdd063336bbeb91f77a7dce (diff)
parent23c3e290fb9ce38cabc2822b47583fc8702411bf (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: (200 commits) [SCSI] usbstorage: use last_sector_bug flag universally [SCSI] libsas: abstract STP task status into a function [SCSI] ultrastor: clean up inline asm warnings [SCSI] aic7xxx: fix firmware build [SCSI] aacraid: fib context lock for management ioctls [SCSI] ch: remove forward declarations [SCSI] ch: fix device minor number management bug [SCSI] ch: handle class_device_create failure properly [SCSI] NCR5380: fix section mismatch [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices [SCSI] IB/iSER: add logical unit reset support [SCSI] don't use __GFP_DMA for sense buffers if not required [SCSI] use dynamically allocated sense buffer [SCSI] scsi.h: add macro for enclosure bit of inquiry data [SCSI] sd: add fix for devices with last sector access problems [SCSI] fix pcmcia compile problem [SCSI] aacraid: add Voodoo Lite class of cards. [SCSI] aacraid: add new driver features flags [SCSI] qla2xxx: Update version number to 8.02.00-k7. [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command. ...
Diffstat (limited to 'drivers/scsi/iscsi_tcp.h')
-rw-r--r--drivers/scsi/iscsi_tcp.h134
1 files changed, 51 insertions, 83 deletions
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index 68c36cc8997e..ed0b991d1e72 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -24,71 +24,61 @@
24 24
25#include <scsi/libiscsi.h> 25#include <scsi/libiscsi.h>
26 26
27/* Socket's Receive state machine */
28#define IN_PROGRESS_WAIT_HEADER 0x0
29#define IN_PROGRESS_HEADER_GATHER 0x1
30#define IN_PROGRESS_DATA_RECV 0x2
31#define IN_PROGRESS_DDIGEST_RECV 0x3
32#define IN_PROGRESS_PAD_RECV 0x4
33
34/* xmit state machine */
35#define XMSTATE_VALUE_IDLE 0
36#define XMSTATE_BIT_CMD_HDR_INIT 0
37#define XMSTATE_BIT_CMD_HDR_XMIT 1
38#define XMSTATE_BIT_IMM_HDR 2
39#define XMSTATE_BIT_IMM_DATA 3
40#define XMSTATE_BIT_UNS_INIT 4
41#define XMSTATE_BIT_UNS_HDR 5
42#define XMSTATE_BIT_UNS_DATA 6
43#define XMSTATE_BIT_SOL_HDR 7
44#define XMSTATE_BIT_SOL_DATA 8
45#define XMSTATE_BIT_W_PAD 9
46#define XMSTATE_BIT_W_RESEND_PAD 10
47#define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11
48#define XMSTATE_BIT_IMM_HDR_INIT 12
49#define XMSTATE_BIT_SOL_HDR_INIT 13
50
51#define ISCSI_PAD_LEN 4
52#define ISCSI_SG_TABLESIZE SG_ALL
53#define ISCSI_TCP_MAX_CMD_LEN 16
54
55struct crypto_hash; 27struct crypto_hash;
56struct socket; 28struct socket;
29struct iscsi_tcp_conn;
30struct iscsi_segment;
31
32typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *,
33 struct iscsi_segment *);
34
35struct iscsi_segment {
36 unsigned char *data;
37 unsigned int size;
38 unsigned int copied;
39 unsigned int total_size;
40 unsigned int total_copied;
41
42 struct hash_desc *hash;
43 unsigned char recv_digest[ISCSI_DIGEST_SIZE];
44 unsigned char digest[ISCSI_DIGEST_SIZE];
45 unsigned int digest_len;
46
47 struct scatterlist *sg;
48 void *sg_mapped;
49 unsigned int sg_offset;
50
51 iscsi_segment_done_fn_t *done;
52};
57 53
58/* Socket connection recieve helper */ 54/* Socket connection recieve helper */
59struct iscsi_tcp_recv { 55struct iscsi_tcp_recv {
60 struct iscsi_hdr *hdr; 56 struct iscsi_hdr *hdr;
61 struct sk_buff *skb; 57 struct iscsi_segment segment;
62 int offset; 58
63 int len; 59 /* Allocate buffer for BHS + AHS */
64 int hdr_offset; 60 uint32_t hdr_buf[64];
65 int copy;
66 int copied;
67 int padding;
68 struct iscsi_cmd_task *ctask; /* current cmd in progress */
69 61
70 /* copied and flipped values */ 62 /* copied and flipped values */
71 int datalen; 63 int datalen;
72 int datadgst; 64};
73 char zero_copy_hdr; 65
66/* Socket connection send helper */
67struct iscsi_tcp_send {
68 struct iscsi_hdr *hdr;
69 struct iscsi_segment segment;
70 struct iscsi_segment data_segment;
74}; 71};
75 72
76struct iscsi_tcp_conn { 73struct iscsi_tcp_conn {
77 struct iscsi_conn *iscsi_conn; 74 struct iscsi_conn *iscsi_conn;
78 struct socket *sock; 75 struct socket *sock;
79 struct iscsi_hdr hdr; /* header placeholder */
80 char hdrext[4*sizeof(__u16) +
81 sizeof(__u32)];
82 int data_copied;
83 int stop_stage; /* conn_stop() flag: * 76 int stop_stage; /* conn_stop() flag: *
84 * stop to recover, * 77 * stop to recover, *
85 * stop to terminate */ 78 * stop to terminate */
86 /* iSCSI connection-wide sequencing */
87 int hdr_size; /* PDU header size */
88
89 /* control data */ 79 /* control data */
90 struct iscsi_tcp_recv in; /* TCP receive context */ 80 struct iscsi_tcp_recv in; /* TCP receive context */
91 int in_progress; /* connection state machine */ 81 struct iscsi_tcp_send out; /* TCP send context */
92 82
93 /* old values for socket callbacks */ 83 /* old values for socket callbacks */
94 void (*old_data_ready)(struct sock *, int); 84 void (*old_data_ready)(struct sock *, int);
@@ -103,29 +93,19 @@ struct iscsi_tcp_conn {
103 uint32_t sendpage_failures_cnt; 93 uint32_t sendpage_failures_cnt;
104 uint32_t discontiguous_hdr_cnt; 94 uint32_t discontiguous_hdr_cnt;
105 95
106 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); 96 int error;
107};
108 97
109struct iscsi_buf { 98 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
110 struct scatterlist sg;
111 unsigned int sent;
112 char use_sendmsg;
113}; 99};
114 100
115struct iscsi_data_task { 101struct iscsi_data_task {
116 struct iscsi_data hdr; /* PDU */ 102 struct iscsi_data hdr; /* PDU */
117 char hdrext[sizeof(__u32)]; /* Header-Digest */ 103 char hdrext[ISCSI_DIGEST_SIZE];/* Header-Digest */
118 struct iscsi_buf digestbuf; /* digest buffer */
119 uint32_t digest; /* data digest */
120}; 104};
121 105
122struct iscsi_tcp_mgmt_task { 106struct iscsi_tcp_mgmt_task {
123 struct iscsi_hdr hdr; 107 struct iscsi_hdr hdr;
124 char hdrext[sizeof(__u32)]; /* Header-Digest */ 108 char hdrext[ISCSI_DIGEST_SIZE]; /* Header-Digest */
125 unsigned long xmstate; /* mgmt xmit progress */
126 struct iscsi_buf headbuf; /* header buffer */
127 struct iscsi_buf sendbuf; /* in progress buffer */
128 int sent;
129}; 109};
130 110
131struct iscsi_r2t_info { 111struct iscsi_r2t_info {
@@ -133,38 +113,26 @@ struct iscsi_r2t_info {
133 __be32 exp_statsn; /* copied from R2T */ 113 __be32 exp_statsn; /* copied from R2T */
134 uint32_t data_length; /* copied from R2T */ 114 uint32_t data_length; /* copied from R2T */
135 uint32_t data_offset; /* copied from R2T */ 115 uint32_t data_offset; /* copied from R2T */
136 struct iscsi_buf headbuf; /* Data-Out Header Buffer */
137 struct iscsi_buf sendbuf; /* Data-Out in progress buffer*/
138 int sent; /* R2T sequence progress */ 116 int sent; /* R2T sequence progress */
139 int data_count; /* DATA-Out payload progress */ 117 int data_count; /* DATA-Out payload progress */
140 struct scatterlist *sg; /* per-R2T SG list */
141 int solicit_datasn; 118 int solicit_datasn;
142 struct iscsi_data_task dtask; /* which data task */ 119 struct iscsi_data_task dtask; /* Data-Out header buf */
143}; 120};
144 121
145struct iscsi_tcp_cmd_task { 122struct iscsi_tcp_cmd_task {
146 struct iscsi_cmd hdr; 123 struct iscsi_hdr_buff {
147 char hdrext[4*sizeof(__u16)+ /* AHS */ 124 struct iscsi_cmd cmd_hdr;
148 sizeof(__u32)]; /* HeaderDigest */ 125 char hdrextbuf[ISCSI_MAX_AHS_SIZE +
149 char pad[ISCSI_PAD_LEN]; 126 ISCSI_DIGEST_SIZE];
150 int pad_count; /* padded bytes */ 127 } hdr;
151 struct iscsi_buf headbuf; /* header buf (xmit) */ 128
152 struct iscsi_buf sendbuf; /* in progress buffer*/
153 unsigned long xmstate; /* xmit xtate machine */
154 int sent; 129 int sent;
155 struct scatterlist *sg; /* per-cmd SG list */ 130 uint32_t exp_datasn; /* expected target's R2TSN/DataSN */
156 struct scatterlist *bad_sg; /* assert statement */
157 int sg_count; /* SG's to process */
158 uint32_t exp_datasn; /* expected target's R2TSN/DataSN */
159 int data_offset; 131 int data_offset;
160 struct iscsi_r2t_info *r2t; /* in progress R2T */ 132 struct iscsi_r2t_info *r2t; /* in progress R2T */
161 struct iscsi_queue r2tpool; 133 struct iscsi_pool r2tpool;
162 struct kfifo *r2tqueue; 134 struct kfifo *r2tqueue;
163 struct iscsi_r2t_info **r2ts; 135 struct iscsi_data_task unsol_dtask; /* Data-Out header buf */
164 int digest_count;
165 uint32_t immdigest; /* for imm data */
166 struct iscsi_buf immbuf; /* for imm data digest */
167 struct iscsi_data_task unsol_dtask; /* unsol data task */
168}; 136};
169 137
170#endif /* ISCSI_H */ 138#endif /* ISCSI_H */