36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * CDDL HEADER START
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * The contents of this file are subject to the terms of the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Common Development and Distribution License (the "License").
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * You may not use this file except in compliance with the License.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * or http://www.opensolaris.org/os/licensing.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * See the License for the specific language governing permissions
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * and limitations under the License.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * When distributing Covered Code, include this CDDL HEADER in each
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * If applicable, add the following below this CDDL HEADER, with the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * fields enclosed by brackets "[]" replaced with your own identifying
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * information: Portions Copyright [yyyy] [name of copyright owner]
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * CDDL HEADER END
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#ifndef _ISCSI_PROTOCOL_H
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define _ISCSI_PROTOCOL_H
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#ifdef __cplusplus
36c5fee33fa8b822175d410202aebcf592c8d342mcnealextern "C" {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#endif
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iSCSI connection daemon
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Copyright (C) 2001 Cisco Systems, Inc.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * All rights reserved.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * This file sets up definitions of messages and constants used by the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iSCSI protocol.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal *
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#include <sys/types.h>
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#include <sys/isa_defs.h>
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_NAME_LEN 224
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China#define ISCSI_MAX_C_USER_LEN 512
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI listen port for incoming connections */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LISTEN_PORT 3260
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* assumes a pointer to a 3-byte array */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* assumes a pointer to a 3 byte array, and an integer value */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define hton24(p, v) {\
36c5fee33fa8b822175d410202aebcf592c8d342mcneal p[0] = (((v) >> 16) & 0xFF); \
36c5fee33fa8b822175d410202aebcf592c8d342mcneal p[1] = (((v) >> 8) & 0xFF); \
36c5fee33fa8b822175d410202aebcf592c8d342mcneal p[2] = ((v) & 0xFF); \
36c5fee33fa8b822175d410202aebcf592c8d342mcneal}
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* for Login min, max, active version fields */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MIN_VERSION 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DRAFT8_VERSION 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DRAFT20_VERSION 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_VERSION 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Min. and Max. length of a PDU we can support */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MIN_PDU_LENGTH (8 << 9) /* 4KB */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_PDU_LENGTH (0xffffffff) /* Huge */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Padding word length */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_PAD_WORD_LEN 4
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Max. number of Key=Value pairs in a text message */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_KEY_VALUE_PAIRS 8192
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* text separtor between key value pairs exhanged in login */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TEXT_SEPARATOR '='
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/* reserved text constants for Text Mode Negotiation */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_TEXT_NONE "None"
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_TEXT_REJECT "Reject"
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_TEXT_IRRELEVANT "Irrelevant"
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_TEXT_NOTUNDERSTOOD "NotUnderstood"
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reserved value for initiator/target task tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_RSVD_TASK_TAG 0xffffffff
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* maximum length for text keys/values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define KEY_MAXLEN 64
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define VALUE_MAXLEN 255
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define TARGET_NAME_MAXLEN VALUE_MAXLEN
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* most PDU types have a final bit */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_FINAL 0x80
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Strings used during SendTargets requests
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TEXT_SEPARATOR '='
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define TARGETNAME "TargetName="
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define TARGETADDRESS "TargetAddress="
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Template Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags; /* Final bit */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength; /* AHSs total length */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3]; /* Data length */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t other[16];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd1[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[4];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[12];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Opcode encoding bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_RETRY 0x80
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_IMMEDIATE 0x40
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OPCODE_MASK 0x3F
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Client to Server Message Opcode values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_NOOP_OUT 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_CMD 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_TASK_MGT_MSG 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_LOGIN_CMD 0x03
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_TEXT_CMD 0x04
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_DATA 0x05
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_LOGOUT_CMD 0x06
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SNACK_CMD 0x10
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Server to Client Message Opcode values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_NOOP_IN 0x20
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_RSP 0x21
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_TASK_MGT_RSP 0x22
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_LOGIN_RSP 0x23
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_TEXT_RSP 0x24
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_SCSI_DATA_RSP 0x25
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_LOGOUT_RSP 0x26
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_RTT_RSP 0x31
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_ASYNC_EVENT 0x32
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_REJECT_MSG 0x3f
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Command Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_scsi_cmd_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t data_length;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t scb[16]; /* SCSI Command Block */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Additional Data (Command Dependent)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_scsi_cmd_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Command PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_READ 0x40
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_WRITE 0x20
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_ATTR_MASK 0x07 /* 3 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Command Attribute values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ATTR_UNTAGGED 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ATTR_SIMPLE 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ATTR_ORDERED 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ATTR_HEAD_OF_QUEUE 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ATTR_ACA 4
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_scsi_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t response;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t cmd_status;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd1;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expdatasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t bi_residual_count;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t residual_count;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Response or Sense Data (optional)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_scsi_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* 10.2.2.3 - Extended CDB Additional Header Segment */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_addl_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal iscsi_scsi_cmd_hdr_t ahs_isch;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t ahs_hlen_hi;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t ahs_hlen_lo;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t ahs_key;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t ahs_resv;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t ahs_extscb[4];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_addl_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Command Response PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_BIDI_OVERFLOW 0x10
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_BIDI_UNDERFLOW 0x08
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_OVERFLOW 0x04
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_CMD_UNDERFLOW 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Status values. Valid if Rsp Selector bit is not set */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_CMD_COMPLETED 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_TARGET_FAILURE 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_SUBSYS_FAILURE 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Asynchronous Event Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_async_evt_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t async_event;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t async_vcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t param1;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t param2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t param3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd5[4];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_async_evt_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Event Indicator values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_SCSI_EVENT 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_REQUEST_LOGOUT 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_DROPPING_CONNECTION 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_DROPPING_ALL_CONNECTIONS 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_PARAM_NEGOTIATION 4
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_ASYNC_EVENT_VENDOR_SPECIFIC 255
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* NOP-Out Message */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_nop_out_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t rsvd2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt; /* Target Transfer Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[16];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_nop_out_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* NOP-In Message */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_nop_in_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t rsvd2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt; /* Target Transfer Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[12];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_nop_in_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Task Management Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_scsi_task_mgt_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t function;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd1[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rtt; /* Reference Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t refcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expdatasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_scsi_task_mgt_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_TASK_MGMT_FUNCTION_MASK 0x7F
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Function values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_ABORT_TASK 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_ABORT_TASK_SET 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_CLEAR_ACA 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_CLEAR_TASK_SET 4
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_LOGICAL_UNIT_RESET 5
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_TARGET_WARM_RESET 6
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_TARGET_COLD_RESET 7
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_TM_FUNC_TASK_REASSIGN 8
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Task Management Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_scsi_task_mgt_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t response; /* see Response values below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t qualifier;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rtt; /* Reference Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[12];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_scsi_task_mgt_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Response values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define SCSI_TCP_TM_RESP_COMPLETE 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define SCSI_TCP_TM_RESP_NO_TASK 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define SCSI_TCP_TM_RESP_NO_LUN 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define SCSI_TCP_TM_RESP_TASK_ALLEGIANT 0x03
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_NO_ALLG_REASSN 0x04
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_FUNC_NOT_SUPP 0x05
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_FUNC_AUTH_FAIL 0x06
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define SCSI_TCP_TM_RESP_REJECTED 0xff
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Maintained for backward compatibility.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_NO_FAILOVER SCSI_TCP_TM_RESP_NO_ALLG_REASSN
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_IN_PRGRESS SCSI_TCP_TM_RESP_FUNC_NOT_SUPP
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Ready To Transfer Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_rtt_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[12];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt; /* Target Transfer Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rttsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t data_offset;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t data_length;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_rtt_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Data Hdr */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_data_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd4;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd5;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t datasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t offset;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd6;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Payload
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_data_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Data Response Hdr */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_data_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t cmd_status;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t lun[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t datasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t offset;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t residual_count;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_data_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Data Response PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_DATA_ACK 0x40
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_DATA_OVERFLOW 0x04
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_DATA_UNDERFLOW 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_DATA_STATUS 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Text Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_text_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd5[16];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text - key=value pairs
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_text_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_TEXT_CONTINUE 0x40
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Text Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_text_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t ttt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd5[12];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text Response - key:value pairs
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_text_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_ISID_LEN 6
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_login_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t max_version; /* Max. version supported */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t min_version; /* Min. version supported */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t isid[ISCSI_ISID_LEN]; /* Initiator Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t tsid; /* Target Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t cid;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd5[16];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_login_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_TRANSIT 0x80
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_CONTINUE 0x40
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_CURRENT_STAGE(flags) \
36c5fee33fa8b822175d410202aebcf592c8d342mcneal ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_NEXT_STAGE(flags) \
36c5fee33fa8b822175d410202aebcf592c8d342mcneal (flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_login_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t max_version; /* Max. version supported */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t active_version; /* Active version */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t isid[ISCSI_ISID_LEN]; /* Initiator Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t tsid; /* Target Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t status_class; /* see Login RSP ststus classes below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t status_detail; /* see Login RSP Status details below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[10];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_login_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login stage (phase) codes for CSG, NSG */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_SECURITY_NEGOTIATION_STAGE 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_OP_PARMS_NEGOTIATION_STAGE 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FULL_FEATURE_PHASE 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Status response classes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_CLASS_SUCCESS 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_CLASS_REDIRECT 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_CLASS_INITIATOR_ERR 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_STATUS_CLASS_TARGET_ERR 0x03
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Status response detail codes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-0 (Success) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_ACCEPT 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-1 (Redirection) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TGT_MOVED_TEMP 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TGT_MOVED_PERM 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-2 (Initiator Error) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_INIT_ERR 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_AUTH_FAILED 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TGT_FORBIDDEN 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TGT_NOT_FOUND 0x03
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TGT_REMOVED 0x04
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_NO_VERSION 0x05
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_ISID_ERROR 0x06
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_MISSING_FIELDS 0x07
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_CONN_ADD_FAILED 0x08
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_NO_SESSION_TYPE 0x09
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_NO_SESSION 0x0a
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_INVALID_REQUEST 0x0b
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-3 (Target Error) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_TARGET_ERROR 0x00
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE 0x01
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGIN_STATUS_NO_RESOURCES 0x02
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_logout_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd1[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t cid;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[2];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t cmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd4[16];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_logout_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGOUT_REASON_MASK 0x7F
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* logout reason_code values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_REASON_CLOSE_SESSION 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_REASON_RECOVERY 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_REASON_AEN_REQUEST 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_logout_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t response; /* see Logout response values below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t hlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt; /* Initiator Task Tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd4;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd5;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t t2wait;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint16_t t2retain;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd6;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_logout_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* logout response status values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_SUCCESS 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_CID_NOT_FOUND 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_RECOVERY_UNSUPPORTED 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_LOGOUT_CLEANUP_FAILED 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SNACK Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_snack_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2[14];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t itt;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t begrun;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t runlength;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expstatsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expdatasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd6[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_snack_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SNACK PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reject Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcnealtypedef struct _iscsi_reject_rsp_hdr {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t opcode;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t flags;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t reason;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd2;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd3;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t dlength[3];
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t rsvd4[8];
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t must_be_ff[4];
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t rsvd4a[4];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t statsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t expcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t maxcmdsn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint32_t datasn;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t rsvd5[8];
36c5fee33fa8b822175d410202aebcf592c8d342mcneal /*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text - Rejected hdr
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal} iscsi_reject_rsp_hdr_t;
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reason for Reject */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_CMD_BEFORE_LOGIN 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_DATA_DIGEST_ERROR 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_SNACK_REJECT 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_PROTOCOL_ERROR 4
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_CMD_NOT_SUPPORTED 5
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_IMM_CMD_REJECT 6
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_TASK_IN_PROGRESS 7
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_INVALID_DATA_ACK 8
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_INVALID_PDU_FIELD 9
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_LONG_OPERATION_REJECT 10
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_NEGOTIATION_RESET 11
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_REJECT_WAITING_FOR_LOGOUT 12
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Defaults as defined by the iSCSI specification */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_IMMEDIATE_DATA TRUE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_INITIALR2T TRUE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_FIRST_BURST_LENGTH (64 * 1024) /* 64kbytes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_MAX_BURST_LENGTH (256 * 1024) /* 256kbytes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_DATA_PDU_IN_ORDER TRUE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_DATA_SEQUENCE_IN_ORDER TRUE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_TIME_TO_WAIT 2 /* 2 seconds */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_TIME_TO_RETAIN 20 /* 20 seconds */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_HEADER_DIGEST ISCSI_DIGEST_NONE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_DATA_DIGEST ISCSI_DIGEST_NONE
1a1a84a324206b6b1f5f704ab166c4ebf78aed76Peter Dunlap#define ISCSI_DEFAULT_MAX_RECV_SEG_LEN (8 * 1024)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_MAX_XMIT_SEG_LEN (8 * 1024)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_MAX_CONNECTIONS 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_MAX_OUT_R2T 1
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_ERROR_RECOVERY_LEVEL 0
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_IFMARKER FALSE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_OFMARKER FALSE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Minimum values from the iSCSI specification
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_TIME2RETAIN 0
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_TIME2WAIT 0
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_ERROR_RECOVERY_LEVEL 0
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_RECV_DATA_SEGMENT_LENGTH 0x200
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_FIRST_BURST_LENGTH 0x200
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_MAX_BURST_LENGTH 0x200
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_CONNECTIONS 1
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_MAX_OUTSTANDING_R2T 1
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Maximum values from the iSCSI specification
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_HEADER_DIGEST 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_DATA_DIGEST 3
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_TIME2RETAIN 3600
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_TIME2WAIT 3600
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_ERROR_RECOVERY_LEVEL 2
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_FIRST_BURST_LENGTH 0xffffff
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_BURST_LENGTH 0xffffff
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_CONNECTIONS 65535
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_OUTSTANDING_R2T 65535
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH 0xffffff
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_TPGT_VALUE 65535 /* 16 bit numeric */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/*
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iqn and eui name prefixes and related defines
36c5fee33fa8b822175d410202aebcf592c8d342mcneal */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_IQN_NAME_PREFIX "iqn"
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_EUI_NAME_PREFIX "eui"
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_EUI_NAME_LEN 20 /* eui. plus 16 octets */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#ifdef __cplusplus
36c5fee33fa8b822175d410202aebcf592c8d342mcneal}
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#endif
36c5fee33fa8b822175d410202aebcf592c8d342mcneal
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#endif /* _ISCSI_PROTOCOL_H */