diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-26 04:19:08 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-26 04:19:08 +0300 |
commit | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch) | |
tree | 4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/scsi/iscsi_tcp.h | |
parent | 50d9a126240f9961cfdd063336bbeb91f77a7dce (diff) | |
parent | 23c3e290fb9ce38cabc2822b47583fc8702411bf (diff) | |
download | linux-9b73e76f3cf63379dcf45fcd4f112f5812418d0a.tar.xz |
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.h | 134 |
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 @@ #include <scsi/libiscsi.h> -/* Socket's Receive state machine */ -#define IN_PROGRESS_WAIT_HEADER 0x0 -#define IN_PROGRESS_HEADER_GATHER 0x1 -#define IN_PROGRESS_DATA_RECV 0x2 -#define IN_PROGRESS_DDIGEST_RECV 0x3 -#define IN_PROGRESS_PAD_RECV 0x4 - -/* xmit state machine */ -#define XMSTATE_VALUE_IDLE 0 -#define XMSTATE_BIT_CMD_HDR_INIT 0 -#define XMSTATE_BIT_CMD_HDR_XMIT 1 -#define XMSTATE_BIT_IMM_HDR 2 -#define XMSTATE_BIT_IMM_DATA 3 -#define XMSTATE_BIT_UNS_INIT 4 -#define XMSTATE_BIT_UNS_HDR 5 -#define XMSTATE_BIT_UNS_DATA 6 -#define XMSTATE_BIT_SOL_HDR 7 -#define XMSTATE_BIT_SOL_DATA 8 -#define XMSTATE_BIT_W_PAD 9 -#define XMSTATE_BIT_W_RESEND_PAD 10 -#define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11 -#define XMSTATE_BIT_IMM_HDR_INIT 12 -#define XMSTATE_BIT_SOL_HDR_INIT 13 - -#define ISCSI_PAD_LEN 4 -#define ISCSI_SG_TABLESIZE SG_ALL -#define ISCSI_TCP_MAX_CMD_LEN 16 - struct crypto_hash; struct socket; +struct iscsi_tcp_conn; +struct iscsi_segment; + +typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *, + struct iscsi_segment *); + +struct iscsi_segment { + unsigned char *data; + unsigned int size; + unsigned int copied; + unsigned int total_size; + unsigned int total_copied; + + struct hash_desc *hash; + unsigned char recv_digest[ISCSI_DIGEST_SIZE]; + unsigned char digest[ISCSI_DIGEST_SIZE]; + unsigned int digest_len; + + struct scatterlist *sg; + void *sg_mapped; + unsigned int sg_offset; + + iscsi_segment_done_fn_t *done; +}; /* Socket connection recieve helper */ struct iscsi_tcp_recv { struct iscsi_hdr *hdr; - struct sk_buff *skb; - int offset; - int len; - int hdr_offset; - int copy; - int copied; - int padding; - struct iscsi_cmd_task *ctask; /* current cmd in progress */ + struct iscsi_segment segment; + + /* Allocate buffer for BHS + AHS */ + uint32_t hdr_buf[64]; /* copied and flipped values */ int datalen; - int datadgst; - char zero_copy_hdr; +}; + +/* Socket connection send helper */ +struct iscsi_tcp_send { + struct iscsi_hdr *hdr; + struct iscsi_segment segment; + struct iscsi_segment data_segment; }; struct iscsi_tcp_conn { struct iscsi_conn *iscsi_conn; struct socket *sock; - struct iscsi_hdr hdr; /* header placeholder */ - char hdrext[4*sizeof(__u16) + - sizeof(__u32)]; - int data_copied; int stop_stage; /* conn_stop() flag: * * stop to recover, * * stop to terminate */ - /* iSCSI connection-wide sequencing */ - int hdr_size; /* PDU header size */ - /* control data */ struct iscsi_tcp_recv in; /* TCP receive context */ - int in_progress; /* connection state machine */ + struct iscsi_tcp_send out; /* TCP send context */ /* old values for socket callbacks */ void (*old_data_ready)(struct sock *, int); @@ -103,29 +93,19 @@ struct iscsi_tcp_conn { uint32_t sendpage_failures_cnt; uint32_t discontiguous_hdr_cnt; - ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); -}; + int error; -struct iscsi_buf { - struct scatterlist sg; - unsigned int sent; - char use_sendmsg; + ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); }; struct iscsi_data_task { struct iscsi_data hdr; /* PDU */ - char hdrext[sizeof(__u32)]; /* Header-Digest */ - struct iscsi_buf digestbuf; /* digest buffer */ - uint32_t digest; /* data digest */ + char hdrext[ISCSI_DIGEST_SIZE];/* Header-Digest */ }; struct iscsi_tcp_mgmt_task { struct iscsi_hdr hdr; - char hdrext[sizeof(__u32)]; /* Header-Digest */ - unsigned long xmstate; /* mgmt xmit progress */ - struct iscsi_buf headbuf; /* header buffer */ - struct iscsi_buf sendbuf; /* in progress buffer */ - int sent; + char hdrext[ISCSI_DIGEST_SIZE]; /* Header-Digest */ }; struct iscsi_r2t_info { @@ -133,38 +113,26 @@ struct iscsi_r2t_info { __be32 exp_statsn; /* copied from R2T */ uint32_t data_length; /* copied from R2T */ uint32_t data_offset; /* copied from R2T */ - struct iscsi_buf headbuf; /* Data-Out Header Buffer */ - struct iscsi_buf sendbuf; /* Data-Out in progress buffer*/ int sent; /* R2T sequence progress */ int data_count; /* DATA-Out payload progress */ - struct scatterlist *sg; /* per-R2T SG list */ int solicit_datasn; - struct iscsi_data_task dtask; /* which data task */ + struct iscsi_data_task dtask; /* Data-Out header buf */ }; struct iscsi_tcp_cmd_task { - struct iscsi_cmd hdr; - char hdrext[4*sizeof(__u16)+ /* AHS */ - sizeof(__u32)]; /* HeaderDigest */ - char pad[ISCSI_PAD_LEN]; - int pad_count; /* padded bytes */ - struct iscsi_buf headbuf; /* header buf (xmit) */ - struct iscsi_buf sendbuf; /* in progress buffer*/ - unsigned long xmstate; /* xmit xtate machine */ + struct iscsi_hdr_buff { + struct iscsi_cmd cmd_hdr; + char hdrextbuf[ISCSI_MAX_AHS_SIZE + + ISCSI_DIGEST_SIZE]; + } hdr; + int sent; - struct scatterlist *sg; /* per-cmd SG list */ - struct scatterlist *bad_sg; /* assert statement */ - int sg_count; /* SG's to process */ - uint32_t exp_datasn; /* expected target's R2TSN/DataSN */ + uint32_t exp_datasn; /* expected target's R2TSN/DataSN */ int data_offset; - struct iscsi_r2t_info *r2t; /* in progress R2T */ - struct iscsi_queue r2tpool; + struct iscsi_r2t_info *r2t; /* in progress R2T */ + struct iscsi_pool r2tpool; struct kfifo *r2tqueue; - struct iscsi_r2t_info **r2ts; - int digest_count; - uint32_t immdigest; /* for imm data */ - struct iscsi_buf immbuf; /* for imm data digest */ - struct iscsi_data_task unsol_dtask; /* unsol data task */ + struct iscsi_data_task unsol_dtask; /* Data-Out header buf */ }; #endif /* ISCSI_H */ |