aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-10-11 11:32:56 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-10-11 11:32:56 +0000
commit145d7a0577c0a4c292a75e90e5512d22a412ec53 (patch)
tree9c924e5bed1ebefb7904948da28fdc9747332c61 /epan
parent494e873eb07eb366f9dcac28ef6dc8ea9315369f (diff)
add a task_flags bitmap and two lengths (data and bidirectional data)
so that the two scsi transports FCP and ISCSI can provide the expected data transfer lengths to SCSI to allow SCSI reassembly. NDMP does not really need these hints since for NDMP (and also iscsi-lite) there is conceptually always both data in and data out phases and there is never any fragmentation. svn path=/trunk/; revision=19493
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-fc.c3
-rw-r--r--epan/dissectors/packet-fcp.c28
-rw-r--r--epan/dissectors/packet-iscsi.c12
-rw-r--r--epan/dissectors/packet-ndmp.c3
-rw-r--r--epan/dissectors/packet-scsi.h22
5 files changed, 67 insertions, 1 deletions
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index 72503b818c..c5e23685e1 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -677,6 +677,9 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
fc_ex->last_exchange_frame=0;
fc_ex->lun=0xffff;
fc_ex->scsi_opcode=0xffff;
+ fc_ex->task_flags=0;
+ fc_ex->data_length=0;
+ fc_ex->bidir_data_length=0;
fc_ex->fc_time=pinfo->fd->abs_ts;
fc_ex->flags=0;
fc_ex->alloc_len=0;
diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c
index c32499e93e..7cb5b1271b 100644
--- a/epan/dissectors/packet-fcp.c
+++ b/epan/dissectors/packet-fcp.c
@@ -61,6 +61,7 @@ static int hf_fcp_addlcdblen = -1;
static int hf_fcp_rddata = -1;
static int hf_fcp_wrdata = -1;
static int hf_fcp_dl = -1;
+static int hf_fcp_bidir_dl = -1;
static int hf_fcp_data_ro = -1;
static int hf_fcp_burstlen = -1;
static int hf_fcp_rspflags = -1;
@@ -397,7 +398,7 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
int offset = 0;
int len,
add_len = 0;
- guint8 flags, lun0;
+ guint8 flags, rwflags, lun0;
guint16 lun=0xffff;
tvbuff_t *cdb_tvb;
int tvb_len, tvb_rlen;
@@ -447,6 +448,15 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
proto_tree_add_item(tree, hf_fcp_taskattr, tvb, offset+9, 1, 0);
dissect_task_mgmt_flags(pinfo, tree, tvb, offset+10);
proto_tree_add_item(tree, hf_fcp_addlcdblen, tvb, offset+11, 1, 0);
+ rwflags=tvb_get_guint8(tvb, offset+11);
+ if(fchdr->itlq){
+ if(rwflags&0x02){
+ fchdr->itlq->task_flags|=SCSI_DATA_READ;
+ }
+ if(rwflags&0x01){
+ fchdr->itlq->task_flags|=SCSI_DATA_WRITE;
+ }
+ }
proto_tree_add_item(tree, hf_fcp_rddata, tvb, offset+11, 1, 0);
proto_tree_add_item(tree, hf_fcp_wrdata, tvb, offset+11, 1, 0);
@@ -461,6 +471,20 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
proto_tree_add_item(tree, hf_fcp_dl, tvb, offset+12+16+add_len,
4, 0);
+ if(fchdr->itlq){
+ fchdr->itlq->data_length=tvb_get_ntohl(tvb, offset+12+16+add_len);
+ }
+
+ if( ((rwflags&0x03)==0x03)
+ && tvb_length_remaining(tvb, offset+12+16+add_len+4)>=4){
+ proto_tree_add_item(tree, hf_fcp_bidir_dl, tvb, offset+12+16+add_len+4,
+ 4, 0);
+ if(fchdr->itlq){
+ fchdr->itlq->bidir_data_length=tvb_get_ntohl(tvb, offset+12+16+add_len+4);
+ }
+
+ }
+
}
static void
@@ -713,6 +737,8 @@ proto_register_fcp (void)
{"WRDATA", "fcp.wrdata", FT_BOOLEAN, 8, NULL, 0x01, "", HFILL}},
{ &hf_fcp_dl,
{"FCP_DL", "fcp.dl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
+ { &hf_fcp_bidir_dl,
+ {"FCP_BIDIRECTIONAL_READ_DL", "fcp.bidir_dl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
{ &hf_fcp_data_ro,
{"FCP_DATA_RO", "fcp.data_ro", FT_UINT32, BASE_DEC, NULL, 0x0, "",
HFILL}},
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c
index 9355c21972..cd6663e352 100644
--- a/epan/dissectors/packet-iscsi.c
+++ b/epan/dissectors/packet-iscsi.c
@@ -770,6 +770,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
cdata = se_alloc (sizeof(iscsi_conv_data_t));
cdata->itlq.lun=0xffff;
cdata->itlq.scsi_opcode=0xffff;
+ cdata->itlq.task_flags=0;
+ cdata->itlq.data_length=0;
+ cdata->itlq.bidir_data_length=0;
cdata->itlq.fc_time = pinfo->fd->abs_ts;
cdata->itlq.first_exchange_frame=0;
cdata->itlq.last_exchange_frame=0;
@@ -958,12 +961,19 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
guint32 ahsLen = tvb_get_guint8(tvb, offset + 4) * 4;
{
gint b = tvb_get_guint8(tvb, offset + 1);
+
proto_item *tf = proto_tree_add_uint(ti, hf_iscsi_Flags, tvb, offset + 1, 1, b);
proto_tree *tt = proto_item_add_subtree(tf, ett_iscsi_Flags);
proto_tree_add_boolean(tt, hf_iscsi_SCSICommand_F, tvb, offset + 1, 1, b);
proto_tree_add_boolean(tt, hf_iscsi_SCSICommand_R, tvb, offset + 1, 1, b);
+ if(b&0x40){
+ cdata->itlq.task_flags|=SCSI_DATA_READ;
+ }
proto_tree_add_boolean(tt, hf_iscsi_SCSICommand_W, tvb, offset + 1, 1, b);
+ if(b&0x20){
+ cdata->itlq.task_flags|=SCSI_DATA_WRITE;
+ }
proto_tree_add_uint(tt, hf_iscsi_SCSICommand_Attr, tvb, offset + 1, 1, b);
}
if(iscsi_protocol_version < ISCSI_PROTOCOL_DRAFT12) {
@@ -974,6 +984,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
proto_tree_add_item(ti, hf_iscsi_LUN, tvb, offset + 8, 8, FALSE);
proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_ExpectedDataTransferLength, tvb, offset + 20, 4, FALSE);
+ cdata->itlq.data_length=tvb_get_ntohl(tvb, offset+20);
proto_tree_add_item(ti, hf_iscsi_CmdSN, tvb, offset + 24, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_ExpStatSN, tvb, offset + 28, 4, FALSE);
if(ahsLen > 0) {
@@ -1004,6 +1015,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
ahs_offset++;
/* read data length */
proto_tree_add_item(ti, hf_iscsi_AHS_read_data_length, tvb, ahs_offset, 4, FALSE);
+ cdata->itlq.bidir_data_length=tvb_get_ntohl(tvb, ahs_offset);
ahs_offset+=4;
break;
default:
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index 7502e49d15..8a352a2344 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -1186,6 +1186,9 @@ dissect_execute_cdb_cdb(tvbuff_t *tvb, int offset, packet_info *pinfo,
ndmp_conv_data->task->itlq->first_exchange_frame=pinfo->fd->num;
ndmp_conv_data->task->itlq->last_exchange_frame=0;
ndmp_conv_data->task->itlq->scsi_opcode=0xffff;
+ ndmp_conv_data->task->itlq->task_flags=0;
+ ndmp_conv_data->task->itlq->data_length=0;
+ ndmp_conv_data->task->itlq->bidir_data_length=0;
ndmp_conv_data->task->itlq->flags=0;
ndmp_conv_data->task->itlq->alloc_len=0;
ndmp_conv_data->task->itlq->fc_time=pinfo->fd->abs_ts;
diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h
index 41b82f696d..0f8306c927 100644
--- a/epan/dissectors/packet-scsi.h
+++ b/epan/dissectors/packet-scsi.h
@@ -53,10 +53,32 @@ typedef struct _itlq_nexus_t {
guint16 lun; /* initialized to 0xffff == unknown */
guint16 scsi_opcode; /* initialized to 0xffff == unknown */
guint16 flags;
+
+#define SCSI_DATA_READ 0x0001
+#define SCSI_DATA_WRITE 0x0002
+ guint16 task_flags; /* Flags set by the transport for this
+ * scsi task.
+ *
+ * If there is no data being transferred both flags
+ * are 0 and both data lengths below are undefined.
+ *
+ * If one of the flags are set the amount of
+ * data being transferred is held in data_length
+ * and bidir_data_length is undefined.
+ *
+ * If both flags are set (a bidirectional transfer)
+ * data_length specifies the amount of DATA-OUT and
+ * bidir_data_length specifies the amount of DATA-IN
+ */
+ guint32 data_length;
+ guint32 bidir_data_length;
+
guint32 alloc_len; /* we need to track alloc_len between the CDB and
* the DATA pdus for some opcodes.
*/
nstime_t fc_time;
+
+
void *extra_data; /* extra data that that is task specific */
} itlq_nexus_t;