aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.h
diff options
context:
space:
mode:
authorOlaf Kirch <olaf.kirch@oracle.com>2007-12-13 13:43:21 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:28:20 -0500
commitda32dd681f7a1a17073c42b375fc23cf73c92155 (patch)
tree5bdca9ef0806fbf09b13d2fc272cda24702f482c /drivers/scsi/iscsi_tcp.h
parent843c0a8a76078cf961b244b839683d0667313740 (diff)
[SCSI] iscsi_tcp: rewrite recv path
Rewrite recv path. Fixes: - data digest processing and error handling. - ahs support. Some fixups by Mike Christie 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.h66
1 files changed, 41 insertions, 25 deletions
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index 7eba44df0a7f..f1c541151100 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -24,13 +24,6 @@
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 */ 27/* xmit state machine */
35#define XMSTATE_IDLE 0x0 28#define XMSTATE_IDLE 0x0
36#define XMSTATE_CMD_HDR_INIT 0x1 29#define XMSTATE_CMD_HDR_INIT 0x1
@@ -54,41 +47,64 @@
54 47
55struct crypto_hash; 48struct crypto_hash;
56struct socket; 49struct socket;
50struct iscsi_tcp_conn;
51struct iscsi_chunk;
52
53typedef int iscsi_chunk_done_fn_t(struct iscsi_tcp_conn *,
54 struct iscsi_chunk *);
55
56struct iscsi_chunk {
57 unsigned char *data;
58 unsigned int size;
59 unsigned int copied;
60 unsigned int total_size;
61 unsigned int total_copied;
62
63 struct hash_desc *hash;
64 unsigned char recv_digest[ISCSI_DIGEST_SIZE];
65 unsigned char digest[ISCSI_DIGEST_SIZE];
66 unsigned int digest_len;
67
68 struct scatterlist *sg;
69 void *sg_mapped;
70 unsigned int sg_offset;
71 unsigned int sg_index;
72 unsigned int sg_count;
73
74 iscsi_chunk_done_fn_t *done;
75};
57 76
58/* Socket connection recieve helper */ 77/* Socket connection recieve helper */
59struct iscsi_tcp_recv { 78struct iscsi_tcp_recv {
60 struct iscsi_hdr *hdr; 79 struct iscsi_hdr *hdr;
61 struct sk_buff *skb; 80 struct iscsi_chunk chunk;
62 int offset; 81
63 int len; 82 /* Allocate buffer for BHS + AHS */
64 int hdr_offset; 83 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 84
70 /* copied and flipped values */ 85 /* copied and flipped values */
71 int datalen; 86 int datalen;
72 int datadgst; 87};
73 char zero_copy_hdr; 88
89/* Socket connection send helper */
90struct iscsi_tcp_send {
91 struct iscsi_hdr *hdr;
92 struct iscsi_chunk chunk;
93 struct iscsi_chunk data_chunk;
94
95 /* Allocate buffer for BHS + AHS */
96 uint32_t hdr_buf[64];
74}; 97};
75 98
76struct iscsi_tcp_conn { 99struct iscsi_tcp_conn {
77 struct iscsi_conn *iscsi_conn; 100 struct iscsi_conn *iscsi_conn;
78 struct socket *sock; 101 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: * 102 int stop_stage; /* conn_stop() flag: *
84 * stop to recover, * 103 * stop to recover, *
85 * stop to terminate */ 104 * stop to terminate */
86 /* iSCSI connection-wide sequencing */
87 int hdr_size; /* PDU header size */
88
89 /* control data */ 105 /* control data */
90 struct iscsi_tcp_recv in; /* TCP receive context */ 106 struct iscsi_tcp_recv in; /* TCP receive context */
91 int in_progress; /* connection state machine */ 107 struct iscsi_tcp_send out; /* TCP send context */
92 108
93 /* old values for socket callbacks */ 109 /* old values for socket callbacks */
94 void (*old_data_ready)(struct sock *, int); 110 void (*old_data_ready)(struct sock *, int);