From d473cc7f15f64ab8a90c3d7288ef30f46785d8d5 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:14 -0500 Subject: [SCSI] iscsi: Some fixes in preparation for bidirectional support - exp_datasn This patch fixes handling of expected datasn/r2tsn as received from target. It is done according to: T10 rfc3720 section 3.2.2.3. Data Sequencing. . unify expected datasn/r2tsn into one counter . calculate than check expected datasn/r2tsn. On error print a message and fail the request. (TODO use iscsi retransmits) . remove the FIXME ;) . avoid zero length memset Signed-off-by: Boaz Harrosh Signed-off-by: Benny Halevy Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/iscsi_tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/scsi/iscsi_tcp.h') diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 32736831790..f909edbf61e 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -152,7 +152,7 @@ struct iscsi_tcp_cmd_task { struct scatterlist *sg; /* per-cmd SG list */ struct scatterlist *bad_sg; /* assert statement */ int sg_count; /* SG's to process */ - uint32_t exp_r2tsn; + uint32_t exp_datasn; /* expected target's R2TSN/DataSN */ int data_offset; struct iscsi_r2t_info *r2t; /* in progress R2T */ struct iscsi_queue r2tpool; -- cgit v1.2.3 From 218432c68085d6c2b04df57daaf105d2ffa2aa61 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:17 -0500 Subject: [SCSI] iscsi tcp: fix iscsi xmit state machine If iscsi_tcp partially sends a header, it would recalculate the header size and readd the size of the digest (if header digests are used).This would cause us to send sizeof(digest) extra bytes when we sent the rest of the header. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/iscsi_tcp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/scsi/iscsi_tcp.h') diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index f909edbf61e..b039160ebaf 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -32,8 +32,8 @@ /* xmit state machine */ #define XMSTATE_IDLE 0x0 -#define XMSTATE_R_HDR 0x1 -#define XMSTATE_W_HDR 0x2 +#define XMSTATE_CMD_HDR_INIT 0x1 +#define XMSTATE_CMD_HDR_XMIT 0x2 #define XMSTATE_IMM_HDR 0x4 #define XMSTATE_IMM_DATA 0x8 #define XMSTATE_UNS_INIT 0x10 @@ -44,6 +44,8 @@ #define XMSTATE_W_PAD 0x200 #define XMSTATE_W_RESEND_PAD 0x400 #define XMSTATE_W_RESEND_DATA_DIGEST 0x800 +#define XMSTATE_IMM_HDR_INIT 0x1000 +#define XMSTATE_SOL_HDR_INIT 0x2000 #define ISCSI_PAD_LEN 4 #define ISCSI_SG_TABLESIZE SG_ALL -- cgit v1.2.3 From dbdb016d92603619d972082167c10b8c74e605cc Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:20 -0500 Subject: [SCSI] iscsi_tcp: fix handling of data buffer padding If we got the padding, data and header in different skbs, we were not handling the padding correctly because we attributed it to the data's skb. This resulted in the initiator reading from pad bytes + skb offset instead of the correct offset. If you could not connect with the open solaris target, this will fix the lock up problem you were hitting. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/iscsi_tcp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/scsi/iscsi_tcp.h') diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index b039160ebaf..7eba44df0a7 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -29,6 +29,7 @@ #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_IDLE 0x0 -- cgit v1.2.3