Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.
This commit is contained in:
parent
530dbb3782
commit
334be04930
@ -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 @@ struct ccb_s {
|
||||
/* 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 @@ struct session_s {
|
||||
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];
|
||||
|
@ -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 @@ send_command(ccb_t *ccb, ccb_disp_t disp, bool waitok, bool immed)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 @@ send_run_xfer(session_t *session, struct scsipi_xfer *xs)
|
||||
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;
|
||||
|
@ -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 @@ get_ccb(connection_t *conn, bool waitok)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user