Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/iscsi Replace the simple tag counter with the comman...



details:   https://anonhg.NetBSD.org/src/rev/ee20d55f987a
branches:  trunk
changeset: 345693:ee20d55f987a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 05 05:36:57 2016 +0000

description:
Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.

diffstat:

 sys/dev/iscsi/iscsi_globals.h |   6 +++---
 sys/dev/iscsi/iscsi_send.c    |  22 ++++++++++++++++++----
 sys/dev/iscsi/iscsi_utils.c   |   4 ++--
 3 files changed, 23 insertions(+), 9 deletions(-)

diffs (97 lines):

diff -r 011226c4a630 -r ee20d55f987a sys/dev/iscsi/iscsi_globals.h
--- a/sys/dev/iscsi/iscsi_globals.h     Sun Jun 05 05:31:43 2016 +0000
+++ b/sys/dev/iscsi/iscsi_globals.h     Sun Jun 05 05:36:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_globals.h,v 1.18 2016/06/05 05:07:23 mlelstv Exp $       */
+/*     $NetBSD: iscsi_globals.h,v 1.19 2016/06/05 05:36:57 mlelstv Exp $       */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -48,6 +48,7 @@
 #include <sys/device.h>
 
 #include <dev/scsipi/scsi_all.h>
+#include <dev/scsipi/scsi_message.h>
 #include <dev/scsipi/scsipi_all.h>
 #include <dev/scsipi/scsiconf.h>
 #include <dev/scsipi/scsipiconf.h>
@@ -285,6 +286,7 @@
        /* length of text data so far */
 
        uint64_t                lun; /* LUN */
+       uint32_t                tag; /* Command tag */
        uint8_t                 *cmd; /* SCSI command block */
        uint16_t                cmdlen; /* SCSI command block length */
        bool                    data_in; /* if this is a read request */
@@ -462,8 +464,6 @@
        connection_t            *mru_connection;
                                /* the most recently used connection */
 
-       uint8_t                 itt_id;         /* counter for use in ITT */
-
        ccb_t                   ccb[CCBS_PER_SESSION];          /* CCBs */
 
        char                    tgtname[ISCSI_STRING_LENGTH + 1];
diff -r 011226c4a630 -r ee20d55f987a sys/dev/iscsi/iscsi_send.c
--- a/sys/dev/iscsi/iscsi_send.c        Sun Jun 05 05:31:43 2016 +0000
+++ b/sys/dev/iscsi/iscsi_send.c        Sun Jun 05 05:36:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_send.c,v 1.24 2016/06/05 05:31:43 mlelstv Exp $  */
+/*     $NetBSD: iscsi_send.c,v 1.25 2016/06/05 05:36:57 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1414,11 +1414,9 @@
                }
        }
 
-       /* currently ignoring tag type and id */
-       pdu->Flags |= ATTR_SIMPLE;
-
        if (!totlen)
                pdu->Flags |= FLAG_FINAL;
+       pdu->Flags |= ccb->tag;
 
        if (ccb->data_in)
                init_sernum(&ccb->DataSN_buf);
@@ -1507,6 +1505,22 @@
        DEB(10, ("RunXfer: Periph_lun = %d, cmd[1] = %x, cmdlen = %d\n",
                        xs->xs_periph->periph_lun, ccb->cmd[1], xs->cmdlen));
 
+       ccb->ITT |= xs->xs_tag_id << 24;
+       switch (xs->xs_tag_type) {
+       case MSG_ORDERED_Q_TAG:
+               ccb->tag = ATTR_ORDERED;
+               break;
+       case MSG_SIMPLE_Q_TAG:
+               ccb->tag = ATTR_SIMPLE;
+               break;
+       case MSG_HEAD_OF_Q_TAG:
+               ccb->tag = ATTR_HEAD_OF_QUEUE;
+               break;
+       default:
+               ccb->tag = 0;
+               break;
+       }
+
 #ifdef LUN_1
        ccb->lun += 0x1000000000000LL;
        ccb->cmd[1] += 0x10;
diff -r 011226c4a630 -r ee20d55f987a sys/dev/iscsi/iscsi_utils.c
--- a/sys/dev/iscsi/iscsi_utils.c       Sun Jun 05 05:31:43 2016 +0000
+++ b/sys/dev/iscsi/iscsi_utils.c       Sun Jun 05 05:36:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_utils.c,v 1.14 2016/06/05 05:18:58 mlelstv Exp $ */
+/*     $NetBSD: iscsi_utils.c,v 1.15 2016/06/05 05:36:57 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2004,2005,2006,2008 The NetBSD Foundation, Inc.
@@ -244,7 +244,7 @@
        ccb->temp_data = NULL;
        ccb->text_data = NULL;
        ccb->status = ISCSI_STATUS_SUCCESS;
-       ccb->ITT = (ccb->ITT & 0xffffff) | (++sess->itt_id << 24);
+       ccb->ITT = (ccb->ITT & 0xffffff);
        ccb->disp = CCBDISP_NOWAIT;
        ccb->connection = conn;
        atomic_inc_uint(&conn->usecount);



Home | Main Index | Thread Index | Old Index