NetworkPkg/IScsiDxe/IScsiProto.h File Reference


Data Structures

struct  _ISCSI_BASIC_HEADER
struct  _ISCSI_ADDTIONAL_HEADER
struct  _ISCSI_BI_EXP_READ_DATA_LEN_AHS
struct  _SCSI_COMMAND
struct  _SCSI_RESPONSE
struct  _ISCSI_SENSE_DATA
struct  _ISCSI_TMF_REQUEST
struct  _ISCSI_TMF_RESPONSE
struct  _ISCSI_SCSI_DATA_OUT
struct  _ISCSI_SCSI_DATA_IN
struct  _ISCSI_READY_TO_TRANSFER
struct  _ISCSI_ASYNC_MESSAGE
struct  _ISCSI_LOGIN_REQUEST
struct  _ISCSI_LOGIN_RESPONSE
struct  _ISCSI_LOGOUT_REQUEST
struct  _ISCSI_LOGOUT_RESPONSE
struct  _ISCSI_SNACK_REQUEST
struct  _ISCSI_REJECT
struct  _ISCSI_NOP_OUT
struct  _ISCSI_NOP_IN
struct  _ISCSI_XFER_CONTEXT
struct  _ISCSI_IN_BUFFER_CONTEXT
struct  _ISCSI_TCB
struct  _ISCSI_KEY_VALUE_PAIR

Defines

#define ISCSI_SEQ_EQ(s1, s2)   ((s1) == (s2))
#define ISCSI_SEQ_LT(s1, s2)
#define ISCSI_SEQ_GT(s1, s2)
#define ISCSI_WELL_KNOWN_PORT   3260
#define ISCSI_MAX_CONNS_PER_SESSION   1
#define DEFAULT_MAX_RECV_DATA_SEG_LEN   8192
#define MAX_RECV_DATA_SEG_LEN_IN_FFP   65536
#define DEFAULT_MAX_OUTSTANDING_R2T   1
#define ISCSI_VERSION_MAX   0x00
#define ISCSI_VERSION_MIN   0x00
#define ISCSI_KEY_AUTH_METHOD   "AuthMethod"
#define ISCSI_KEY_HEADER_DIGEST   "HeaderDigest"
#define ISCSI_KEY_DATA_DIGEST   "DataDigest"
#define ISCSI_KEY_MAX_CONNECTIONS   "MaxConnections"
#define ISCSI_KEY_TARGET_NAME   "TargetName"
#define ISCSI_KEY_INITIATOR_NAME   "InitiatorName"
#define ISCSI_KEY_TARGET_ALIAS   "TargetAlias"
#define ISCSI_KEY_INITIATOR_ALIAS   "InitiatorAlias"
#define ISCSI_KEY_TARGET_ADDRESS   "TargetAddress"
#define ISCSI_KEY_INITIAL_R2T   "InitialR2T"
#define ISCSI_KEY_IMMEDIATE_DATA   "ImmediateData"
#define ISCSI_KEY_TARGET_PORTAL_GROUP_TAG   "TargetPortalGroupTag"
#define ISCSI_KEY_MAX_BURST_LENGTH   "MaxBurstLength"
#define ISCSI_KEY_FIRST_BURST_LENGTH   "FirstBurstLength"
#define ISCSI_KEY_DEFAULT_TIME2WAIT   "DefaultTime2Wait"
#define ISCSI_KEY_DEFAULT_TIME2RETAIN   "DefaultTime2Retain"
#define ISCSI_KEY_MAX_OUTSTANDING_R2T   "MaxOutstandingR2T"
#define ISCSI_KEY_DATA_PDU_IN_ORDER   "DataPDUInOrder"
#define ISCSI_KEY_DATA_SEQUENCE_IN_ORDER   "DataSequenceInOrder"
#define ISCSI_KEY_ERROR_RECOVERY_LEVEL   "ErrorRecoveryLevel"
#define ISCSI_KEY_SESSION_TYPE   "SessionType"
#define ISCSI_KEY_MAX_RECV_DATA_SEGMENT_LENGTH   "MaxRecvDataSegmentLength"
#define ISCSI_KEY_VALUE_NONE   "None"
#define CONN_STATE_FREE   0
#define CONN_STATE_XPT_WAIT   1
#define CONN_STATE_IN_LOGIN   2
#define CONN_STATE_LOGGED_IN   3
#define CONN_STATE_IN_LOGOUT   4
#define CONN_STATE_LOGOUT_REQUESTED   5
#define CONN_STATE_CLEANUP_WAIT   6
#define CONN_STATE_IN_CLEANUP   7
#define SESSION_STATE_FREE   0
#define SESSION_STATE_LOGGED_IN   1
#define SESSION_STATE_FAILED   2
#define ISCSI_RESERVED_TAG   0xffffffff
#define ISCSI_REQ_IMMEDIATE   0x40
#define ISCSI_OPCODE_MASK   0x3F
#define ISCSI_SET_OPCODE(PduHdr, Op, Flgs)   ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) = ((Op) | (Flgs)))
#define ISCSI_GET_OPCODE(PduHdr)   ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) & ISCSI_OPCODE_MASK)
#define ISCSI_CHECK_OPCODE(PduHdr, Op)   ((((PduHdr)->OpCode) & ISCSI_OPCODE_MASK) == (Op))
#define ISCSI_IMMEDIATE_ON(PduHdr)   ((PduHdr)->OpCode & ISCSI_REQ_IMMEDIATE)
#define ISCSI_SET_FLAG(PduHdr, Flag)   (((ISCSI_BASIC_HEADER *) (PduHdr))->Flags |= (BOOLEAN)(Flag))
#define ISCSI_CLEAR_FLAG(PduHdr, Flag)   (((ISCSI_BASIC_HEADER *) (PduHdr))->Flags &= ~(Flag))
#define ISCSI_FLAG_ON(PduHdr, Flag)   ((BOOLEAN) ((((ISCSI_BASIC_HEADER *) (PduHdr))->Flags & (Flag)) == (Flag)))
#define ISCSI_SET_STAGES(PduHdr, Cur, Nxt)   ((PduHdr)->Flags = (UINT8) ((PduHdr)->Flags | ((Cur) << 2 | (Nxt))))
#define ISCSI_GET_CURRENT_STAGE(PduHdr)   ((UINT8) (((PduHdr)->Flags >> 2) & 0x3))
#define ISCSI_GET_NEXT_STAGE(PduHdr)   ((UINT8) (((PduHdr)->Flags) & 0x3))
#define ISCSI_GET_PAD_LEN(DataLen)   ((~(DataLen) + 1) & 0x3)
#define ISCSI_ROUNDUP(DataLen)   (((DataLen) + 3) &~(0x3))
#define HTON24(Dst, Src)
#define NTOH24(src)   (((src)[0] << 16) | ((src)[1] << 8) | ((src)[2]))
#define ISCSI_GET_DATASEG_LEN(PduHdr)   NTOH24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength)
#define ISCSI_SET_DATASEG_LEN(PduHdr, Len)   HTON24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength, (Len))
#define ISCSI_GET_BUFFER_OFFSET(PduHdr)   NTOHL (((ISCSI_SCSI_DATA_IN *) (PduHdr))->BufferOffset)
#define ISCSI_OPCODE_NOP_OUT   0x00
#define ISCSI_OPCODE_SCSI_CMD   0x01
#define ISCSI_OPCODE_SCSI_TMF_REQ   0x02
#define ISCSI_OPCODE_LOGIN_REQ   0x03
#define ISCSI_OPCODE_TEXT_REQ   0x04
#define ISCSI_OPCODE_SCSI_DATA_OUT   0x05
#define ISCSI_OPCODE_LOGOUT_REQ   0x06
#define ISCSI_OPCODE_SNACK_REQ   0x10
#define ISCSI_OPCODE_VENDOR_I0   0x1c
#define ISCSI_OPCODE_VENDOR_I1   0x1d
#define ISCSI_OPCODE_VENDOR_I2   0x1e
#define ISCSI_OPCODE_NOP_IN   0x20
#define ISCSI_OPCODE_SCSI_RSP   0x21
#define ISCSI_OPCODE_SCSI_TMF_RSP   0x22
#define ISCSI_OPCODE_LOGIN_RSP   0x23
#define ISCSI_OPCODE_TEXT_RSP   0x24
#define ISCSI_OPCODE_SCSI_DATA_IN   0x25
#define ISCSI_OPCODE_LOGOUT_RSP   0x26
#define ISCSI_OPCODE_R2T   0x31
#define ISCSI_OPCODE_ASYNC_MSG   0x32
#define ISCSI_OPCODE_VENDOR_T0   0x3c
#define ISCSI_OPCODE_VENDOR_T1   0x3d
#define ISCSI_OPCODE_VENDOR_T2   0x3e
#define ISCSI_OPCODE_REJECT   0x3f
#define ISCSI_BHS_FLAG_FINAL   0x80
#define ISCSI_AHS_TYPE_EXT_CDB   0x1
#define ISCSI_AHS_TYPE_BI_EXP_READ_DATA_LEN   0x2
#define SCSI_CMD_PDU_FLAG_READ   0x40
#define SCSI_CMD_PDU_FLAG_WRITE   0x20
#define ISCSI_CMD_PDU_TASK_ATTR_MASK   0x07
#define ISCSI_TASK_ATTR_UNTAGGED   0x00
#define ISCSI_TASK_ATTR_SIMPLE   0x01
#define ISCSI_TASK_ATTR_ORDERD   0x02
#define ISCSI_TASK_ATTR_HOQ   0x03
#define ISCSI_TASK_ATTR_ACA   0x04
#define SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW   0x10
#define SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW   0x08
#define SCSI_RSP_PDU_FLAG_OVERFLOW   0x04
#define SCSI_RSP_PDU_FLAG_UNDERFLOW   0x02
#define ISCSI_SERVICE_RSP_COMMAND_COMPLETE_AT_TARGET   0x00
#define ISCSI_SERVICE_RSP_TARGET_FAILURE   0x01
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_COMPLETE   0
#define ISCSI_TMF_RSP_PDU_RSP_TASK_NOT_EXIST   1
#define ISCSI_TMF_RSP_PDU_RSP_LUN_NOT_EXIST   2
#define ISCSI_TMF_RSP_PDU_RSP_TASK_STILL_ALLEGIANT   3
#define ISCSI_TMF_RSP_PDU_RSP_TASK_REASSGIN_NOT_SUPPORTED   4
#define ISCSI_TMF_RSP_PDU_RSP_NOT_SUPPORTED   5
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_AHTH_FAILED   6
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_REJECTED   255
#define SCSI_DATA_IN_PDU_FLAG_ACKKNOWLEDGE   0x40
#define SCSI_DATA_IN_PDU_FLAG_OVERFLOW   SCSI_RSP_PDU_FLAG_OVERFLOW
#define SCSI_DATA_IN_PDU_FLAG_UNDERFLOW   SCSI_RSP_PDU_FLAG_UNDERFLOW
#define SCSI_DATA_IN_PDU_FLAG_STATUS_VALID   0x01
#define ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT   0x80
#define ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE   0x40
#define ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT   ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT
#define ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE   ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE
#define ISCSI_LOGIN_STATUS_SUCCESS   0
#define ISCSI_LOGIN_STATUS_REDIRECTION   1
#define ISCSI_LOGIN_STATUS_INITIATOR_ERROR   2
#define ISCSI_LOGIN_STATUS_TARGET_ERROR   3
#define ISCSI_LOGOUT_REASON_CLOSE_SESSION   0
#define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION   1
#define ISCSI_LOGOUT_REASON_REMOVE_CONNECTION_FOR_RECOVERY   2
#define ISCSI_LOGOUT_RESPONSE_SESSION_CLOSED_SUCCESS   0
#define ISCSI_LOGOUT_RESPONSE_CID_NOT_FOUND   1
#define ISCSI_LOGOUT_RESPONSE_RECOVERY_NOT_SUPPORTED   2
#define ISCSI_LOGOUT_RESPONSE_CLEANUP_FAILED   3
#define ISCSI_SNACK_REQUEST_TYPE_DATA_OR_R2T   0
#define ISCSI_SNACK_REQUEST_TYPE_STATUS   1
#define ISCSI_SNACK_REQUEST_TYPE_DATA_ACK   2
#define ISCSI_SNACK_REQUEST_TYPE_RDATA   3
#define ISCSI_SECURITY_NEGOTIATION   0
#define ISCSI_LOGIN_OPERATIONAL_NEGOTIATION   1
#define ISCSI_FULL_FEATURE_PHASE   3

Typedefs

typedef struct _ISCSI_SESSION ISCSI_SESSION
typedef struct _ISCSI_CONNECTION ISCSI_CONNECTION
typedef struct _ISCSI_BASIC_HEADER ISCSI_BASIC_HEADER
typedef struct
_ISCSI_ADDTIONAL_HEADER 
ISCSI_ADDITIONAL_HEADER
typedef struct
_ISCSI_BI_EXP_READ_DATA_LEN_AHS 
ISCSI_BI_EXP_READ_DATA_LEN_AHS
typedef struct _SCSI_COMMAND SCSI_COMMAND
typedef struct _SCSI_RESPONSE SCSI_RESPONSE
typedef struct _ISCSI_SENSE_DATA ISCSI_SENSE_DATA
typedef struct _ISCSI_TMF_REQUEST ISCSI_TMF_REQUEST
typedef struct _ISCSI_TMF_RESPONSE ISCSI_TMF_RESPONSE
typedef struct _ISCSI_SCSI_DATA_OUT ISCSI_SCSI_DATA_OUT
typedef struct _ISCSI_SCSI_DATA_IN ISCSI_SCSI_DATA_IN
typedef struct
_ISCSI_READY_TO_TRANSFER 
ISCSI_READY_TO_TRANSFER
typedef struct _ISCSI_ASYNC_MESSAGE ISCSI_ASYNC_MESSAGE
typedef struct _ISCSI_LOGIN_REQUEST ISCSI_LOGIN_REQUEST
typedef struct
_ISCSI_LOGIN_RESPONSE 
ISCSI_LOGIN_RESPONSE
typedef struct
_ISCSI_LOGOUT_REQUEST 
ISCSI_LOGOUT_REQUEST
typedef struct
_ISCSI_LOGOUT_RESPONSE 
ISCSI_LOGOUT_RESPONSE
typedef struct _ISCSI_SNACK_REQUEST ISCSI_SNACK_REQUEST
typedef struct _ISCSI_REJECT ISCSI_REJECT
typedef struct _ISCSI_NOP_OUT ISCSI_NOP_OUT
typedef struct _ISCSI_NOP_IN ISCSI_NOP_IN
typedef struct _ISCSI_XFER_CONTEXT ISCSI_XFER_CONTEXT
typedef struct
_ISCSI_IN_BUFFER_CONTEXT 
ISCSI_IN_BUFFER_CONTEXT
typedef struct _ISCSI_TCB ISCSI_TCB
typedef struct
_ISCSI_KEY_VALUE_PAIR 
ISCSI_KEY_VALUE_PAIR

Enumerations

enum  DATA_DIRECTION { DataIn = 0, DataOut = 1, DataBi = 2 }
enum  ISCSI_DIGEST_TYPE { IScsiDigestNone, IScsiDigestCRC32 }

Functions

VOID IScsiAttatchConnection (IN OUT ISCSI_SESSION *Session, IN OUT ISCSI_CONNECTION *Conn)
VOID IScsiDetatchConnection (IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiConnLogin (IN OUT ISCSI_CONNECTION *Conn, IN UINT16 Timeout)
ISCSI_CONNECTIONIScsiCreateConnection (IN ISCSI_SESSION *Session)
VOID IScsiDestroyConnection (IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiSessionLogin (IN ISCSI_SESSION *Session)
EFI_STATUS IScsiSessionReLogin (IN ISCSI_SESSION *Session)
EFI_STATUS IScsiSendLoginReq (IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiReceiveLoginRsp (IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiAddKeyValuePair (IN OUT NET_BUF *Pdu, IN CHAR8 *Key, IN CHAR8 *Value)
NET_BUF * IScsiPrepareLoginReq (IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiProcessLoginRsp (IN OUT ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
EFI_STATUS IScsiUpdateTargetAddress (IN OUT ISCSI_SESSION *Session, IN CHAR8 *Data, IN UINT32 Len)
VOID EFIAPI IScsiFreeNbufList (VOID *Arg)
EFI_STATUS IScsiReceivePdu (IN ISCSI_CONNECTION *Conn, OUT NET_BUF **Pdu, IN ISCSI_IN_BUFFER_CONTEXT *Context, IN BOOLEAN HeaderDigest, IN BOOLEAN DataDigest, IN EFI_EVENT TimeoutEvent)
EFI_STATUS IScsiCheckOpParams (IN OUT ISCSI_CONNECTION *Conn)
VOID IScsiFillOpParams (IN ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
EFI_STATUS IScsiPadSegment (IN OUT NET_BUF *Pdu, IN UINT32 Len)
LIST_ENTRY * IScsiBuildKeyValueList (IN CHAR8 *Data, IN UINT32 Len)
CHAR8 * IScsiGetValueByKeyFromList (IN OUT LIST_ENTRY *KeyValueList, IN CHAR8 *Key)
VOID IScsiFreeKeyValueList (IN LIST_ENTRY *KeyValueList)
EFI_STATUS IScsiNormalizeName (IN OUT CHAR8 *Name, IN UINTN Len)
EFI_STATUS IScsiExecuteScsiCommand (IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru, IN UINT8 *Target, IN UINT64 Lun, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
EFI_STATUS IScsiSessionReinstatement (IN ISCSI_SESSION *Session)
VOID IScsiSessionInit (IN OUT ISCSI_SESSION *Session, IN BOOLEAN Recovery)
VOID IScsiSessionAbort (IN OUT ISCSI_SESSION *Session)

Detailed Description

The header file of iSCSI Protocol that defines many specific data structures.

Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define CONN_STATE_CLEANUP_WAIT   6

#define CONN_STATE_FREE   0

connection state for initiator

Referenced by IScsiCreateConnection().

#define CONN_STATE_IN_CLEANUP   7

#define CONN_STATE_IN_LOGIN   2

Referenced by IScsiConnLogin().

#define CONN_STATE_IN_LOGOUT   4

#define CONN_STATE_LOGGED_IN   3

#define CONN_STATE_LOGOUT_REQUESTED   5

#define CONN_STATE_XPT_WAIT   1

#define DEFAULT_MAX_OUTSTANDING_R2T   1

Referenced by IScsiSessionInit().

#define DEFAULT_MAX_RECV_DATA_SEG_LEN   8192

#define HTON24 ( Dst,
Src   ) 

Value:

do { \
    (Dst)[0]  = (UINT8) ((UINT8) ((Src) >> 16) & 0xFF); \
    (Dst)[1]  = (UINT8) ((UINT8) ((Src) >> 8) & 0xFF); \
    (Dst)[2]  = (UINT8) ((UINT8) (Src) & 0xFF); \
  } while (0);

#define ISCSI_AHS_TYPE_BI_EXP_READ_DATA_LEN   0x2

Referenced by IScsiNewScsiCmdPdu().

#define ISCSI_AHS_TYPE_EXT_CDB   0x1

Referenced by IScsiNewScsiCmdPdu().

#define ISCSI_BHS_FLAG_FINAL   0x80

#define ISCSI_CHECK_OPCODE ( PduHdr,
Op   )     ((((PduHdr)->OpCode) & ISCSI_OPCODE_MASK) == (Op))

Referenced by IScsiProcessLoginRsp().

#define ISCSI_CLEAR_FLAG ( PduHdr,
Flag   )     (((ISCSI_BASIC_HEADER *) (PduHdr))->Flags &= ~(Flag))

#define ISCSI_CMD_PDU_TASK_ATTR_MASK   0x07

#define ISCSI_FLAG_ON ( PduHdr,
Flag   )     ((BOOLEAN) ((((ISCSI_BASIC_HEADER *) (PduHdr))->Flags & (Flag)) == (Flag)))

#define ISCSI_FULL_FEATURE_PHASE   3

#define ISCSI_GET_BUFFER_OFFSET ( PduHdr   )     NTOHL (((ISCSI_SCSI_DATA_IN *) (PduHdr))->BufferOffset)

Referenced by IScsiReceivePdu().

#define ISCSI_GET_CURRENT_STAGE ( PduHdr   )     ((UINT8) (((PduHdr)->Flags >> 2) & 0x3))

Referenced by IScsiProcessLoginRsp().

#define ISCSI_GET_DATASEG_LEN ( PduHdr   )     NTOH24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength)

#define ISCSI_GET_NEXT_STAGE ( PduHdr   )     ((UINT8) (((PduHdr)->Flags) & 0x3))

Referenced by IScsiProcessLoginRsp().

#define ISCSI_GET_OPCODE ( PduHdr   )     ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) & ISCSI_OPCODE_MASK)

#define ISCSI_GET_PAD_LEN ( DataLen   )     ((~(DataLen) + 1) & 0x3)

#define ISCSI_IMMEDIATE_ON ( PduHdr   )     ((PduHdr)->OpCode & ISCSI_REQ_IMMEDIATE)

#define ISCSI_KEY_AUTH_METHOD   "AuthMethod"

#define ISCSI_KEY_DATA_DIGEST   "DataDigest"

#define ISCSI_KEY_DATA_PDU_IN_ORDER   "DataPDUInOrder"

#define ISCSI_KEY_DATA_SEQUENCE_IN_ORDER   "DataSequenceInOrder"

#define ISCSI_KEY_DEFAULT_TIME2RETAIN   "DefaultTime2Retain"

#define ISCSI_KEY_DEFAULT_TIME2WAIT   "DefaultTime2Wait"

#define ISCSI_KEY_ERROR_RECOVERY_LEVEL   "ErrorRecoveryLevel"

#define ISCSI_KEY_FIRST_BURST_LENGTH   "FirstBurstLength"

#define ISCSI_KEY_HEADER_DIGEST   "HeaderDigest"

#define ISCSI_KEY_IMMEDIATE_DATA   "ImmediateData"

#define ISCSI_KEY_INITIAL_R2T   "InitialR2T"

#define ISCSI_KEY_INITIATOR_ALIAS   "InitiatorAlias"

#define ISCSI_KEY_INITIATOR_NAME   "InitiatorName"

Referenced by IScsiCHAPToSendReq().

#define ISCSI_KEY_MAX_BURST_LENGTH   "MaxBurstLength"

#define ISCSI_KEY_MAX_CONNECTIONS   "MaxConnections"

#define ISCSI_KEY_MAX_OUTSTANDING_R2T   "MaxOutstandingR2T"

#define ISCSI_KEY_MAX_RECV_DATA_SEGMENT_LENGTH   "MaxRecvDataSegmentLength"

#define ISCSI_KEY_SESSION_TYPE   "SessionType"

#define ISCSI_KEY_TARGET_ADDRESS   "TargetAddress"

#define ISCSI_KEY_TARGET_ALIAS   "TargetAlias"

Referenced by IScsiCheckOpParams().

#define ISCSI_KEY_TARGET_NAME   "TargetName"

Referenced by IScsiCHAPToSendReq().

#define ISCSI_KEY_TARGET_PORTAL_GROUP_TAG   "TargetPortalGroupTag"

#define ISCSI_KEY_VALUE_NONE   "None"

#define ISCSI_LOGIN_OPERATIONAL_NEGOTIATION   1

#define ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE   0x40

#define ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT   0x80

#define ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE   ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE

Referenced by IScsiProcessLoginRsp().

#define ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT   ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT

Referenced by IScsiProcessLoginRsp().

#define ISCSI_LOGIN_STATUS_INITIATOR_ERROR   2

#define ISCSI_LOGIN_STATUS_REDIRECTION   1

Referenced by IScsiProcessLoginRsp().

#define ISCSI_LOGIN_STATUS_SUCCESS   0

Referenced by IScsiProcessLoginRsp().

#define ISCSI_LOGIN_STATUS_TARGET_ERROR   3

#define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION   1

#define ISCSI_LOGOUT_REASON_CLOSE_SESSION   0

#define ISCSI_LOGOUT_REASON_REMOVE_CONNECTION_FOR_RECOVERY   2

#define ISCSI_LOGOUT_RESPONSE_CID_NOT_FOUND   1

#define ISCSI_LOGOUT_RESPONSE_CLEANUP_FAILED   3

#define ISCSI_LOGOUT_RESPONSE_RECOVERY_NOT_SUPPORTED   2

#define ISCSI_LOGOUT_RESPONSE_SESSION_CLOSED_SUCCESS   0

#define ISCSI_MAX_CONNS_PER_SESSION   1

Referenced by IScsiSessionInit().

#define ISCSI_OPCODE_ASYNC_MSG   0x32

Referenced by IScsiReceivePdu().

#define ISCSI_OPCODE_LOGIN_REQ   0x03

Referenced by IScsiPrepareLoginReq().

#define ISCSI_OPCODE_LOGIN_RSP   0x23

#define ISCSI_OPCODE_LOGOUT_REQ   0x06

#define ISCSI_OPCODE_LOGOUT_RSP   0x26

#define ISCSI_OPCODE_MASK   0x3F

#define ISCSI_OPCODE_NOP_IN   0x20

#define ISCSI_OPCODE_NOP_OUT   0x00

#define ISCSI_OPCODE_R2T   0x31

Referenced by IScsiExecuteScsiCommand().

#define ISCSI_OPCODE_REJECT   0x3f

Referenced by IScsiReceivePdu().

#define ISCSI_OPCODE_SCSI_CMD   0x01

Referenced by IScsiNewScsiCmdPdu().

#define ISCSI_OPCODE_SCSI_DATA_IN   0x25

#define ISCSI_OPCODE_SCSI_DATA_OUT   0x05

Referenced by IScsiNewDataOutPdu().

#define ISCSI_OPCODE_SCSI_RSP   0x21

#define ISCSI_OPCODE_SCSI_TMF_REQ   0x02

#define ISCSI_OPCODE_SCSI_TMF_RSP   0x22

#define ISCSI_OPCODE_SNACK_REQ   0x10

#define ISCSI_OPCODE_TEXT_REQ   0x04

#define ISCSI_OPCODE_TEXT_RSP   0x24

Referenced by IScsiReceivePdu().

#define ISCSI_OPCODE_VENDOR_I0   0x1c

#define ISCSI_OPCODE_VENDOR_I1   0x1d

#define ISCSI_OPCODE_VENDOR_I2   0x1e

#define ISCSI_OPCODE_VENDOR_T0   0x3c

#define ISCSI_OPCODE_VENDOR_T1   0x3d

#define ISCSI_OPCODE_VENDOR_T2   0x3e

#define ISCSI_REQ_IMMEDIATE   0x40

Referenced by IScsiPrepareLoginReq().

#define ISCSI_RESERVED_TAG   0xffffffff

#define ISCSI_ROUNDUP ( DataLen   )     (((DataLen) + 3) &~(0x3))

Referenced by IScsiNewScsiCmdPdu().

#define ISCSI_SECURITY_NEGOTIATION   0

#define ISCSI_SEQ_EQ ( s1,
s2   )     ((s1) == (s2))

Referenced by IScsiCheckSN(), and IScsiOnR2TRcvd().

#define ISCSI_SEQ_GT ( s1,
s2   ) 

Value:

( \
      (((INT32) (s1) < (INT32) (s2)) && (s2 - s1) > ((UINT32) 1 << 31)) || \
      (((INT32) (s1) > (INT32) (s2)) && (s1 - s2) < ((UINT32) 1 << 31)) \
    )

Referenced by IScsiNewTcb(), and IScsiUpdateCmdSN().

#define ISCSI_SEQ_LT ( s1,
s2   ) 

Value:

( \
      (((INT32) (s1) < (INT32) (s2)) && (s2 - s1) < ((UINT32) 1 << 31)) || \
      (((INT32) (s1) > (INT32) (s2)) && (s1 - s2) > ((UINT32) 1 << 31)) \
    )

Referenced by IScsiCheckSN(), and IScsiUpdateCmdSN().

#define ISCSI_SERVICE_RSP_COMMAND_COMPLETE_AT_TARGET   0x00

Referenced by IScsiOnScsiRspRcvd().

#define ISCSI_SERVICE_RSP_TARGET_FAILURE   0x01

#define ISCSI_SET_DATASEG_LEN ( PduHdr,
Len   )     HTON24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength, (Len))

#define ISCSI_SET_FLAG ( PduHdr,
Flag   )     (((ISCSI_BASIC_HEADER *) (PduHdr))->Flags |= (BOOLEAN)(Flag))

#define ISCSI_SET_OPCODE ( PduHdr,
Op,
Flgs   )     ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) = ((Op) | (Flgs)))

#define ISCSI_SET_STAGES ( PduHdr,
Cur,
Nxt   )     ((PduHdr)->Flags = (UINT8) ((PduHdr)->Flags | ((Cur) << 2 | (Nxt))))

Referenced by IScsiPrepareLoginReq().

#define ISCSI_SNACK_REQUEST_TYPE_DATA_ACK   2

#define ISCSI_SNACK_REQUEST_TYPE_DATA_OR_R2T   0

#define ISCSI_SNACK_REQUEST_TYPE_RDATA   3

#define ISCSI_SNACK_REQUEST_TYPE_STATUS   1

#define ISCSI_TASK_ATTR_ACA   0x04

#define ISCSI_TASK_ATTR_HOQ   0x03

#define ISCSI_TASK_ATTR_ORDERD   0x02

#define ISCSI_TASK_ATTR_SIMPLE   0x01

Referenced by IScsiNewScsiCmdPdu().

#define ISCSI_TASK_ATTR_UNTAGGED   0x00

#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_AHTH_FAILED   6

#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_COMPLETE   0

#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_REJECTED   255

#define ISCSI_TMF_RSP_PDU_RSP_LUN_NOT_EXIST   2

#define ISCSI_TMF_RSP_PDU_RSP_NOT_SUPPORTED   5

#define ISCSI_TMF_RSP_PDU_RSP_TASK_NOT_EXIST   1

#define ISCSI_TMF_RSP_PDU_RSP_TASK_REASSGIN_NOT_SUPPORTED   4

#define ISCSI_TMF_RSP_PDU_RSP_TASK_STILL_ALLEGIANT   3

#define ISCSI_VERSION_MAX   0x00

Referenced by IScsiPrepareLoginReq().

#define ISCSI_VERSION_MIN   0x00

Referenced by IScsiPrepareLoginReq().

#define ISCSI_WELL_KNOWN_PORT   3260

#define MAX_RECV_DATA_SEG_LEN_IN_FFP   65536

#define NTOH24 ( src   )     (((src)[0] << 16) | ((src)[1] << 8) | ((src)[2]))

Referenced by IScsiAddKeyValuePair().

#define SCSI_CMD_PDU_FLAG_READ   0x40

Referenced by IScsiNewScsiCmdPdu().

#define SCSI_CMD_PDU_FLAG_WRITE   0x20

Referenced by IScsiNewScsiCmdPdu().

#define SCSI_DATA_IN_PDU_FLAG_ACKKNOWLEDGE   0x40

#define SCSI_DATA_IN_PDU_FLAG_OVERFLOW   SCSI_RSP_PDU_FLAG_OVERFLOW

Referenced by IScsiOnDataInRcvd().

#define SCSI_DATA_IN_PDU_FLAG_STATUS_VALID   0x01

Referenced by IScsiOnDataInRcvd().

#define SCSI_DATA_IN_PDU_FLAG_UNDERFLOW   SCSI_RSP_PDU_FLAG_UNDERFLOW

Referenced by IScsiOnDataInRcvd().

#define SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW   0x10

Referenced by IScsiOnScsiRspRcvd().

#define SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW   0x08

Referenced by IScsiOnScsiRspRcvd().

#define SCSI_RSP_PDU_FLAG_OVERFLOW   0x04

#define SCSI_RSP_PDU_FLAG_UNDERFLOW   0x02

#define SESSION_STATE_FAILED   2

Referenced by IScsiSessionAbort().

#define SESSION_STATE_FREE   0

session state for initiator

Referenced by IScsiProcessLoginRsp(), IScsiSessionInit(), and IScsiSessionReinstatement().

#define SESSION_STATE_LOGGED_IN   1


Typedef Documentation

iSCSI Basic Header Segment

Login Request.

Login Response.

Logout Request.

Logout Response.

typedef struct _ISCSI_NOP_IN ISCSI_NOP_IN

NOP-In.

typedef struct _ISCSI_NOP_OUT ISCSI_NOP_OUT

NOP-Out.

Ready To Transfer.

typedef struct _ISCSI_REJECT ISCSI_REJECT

Reject.

SCSI Data-In

SCSI Data-Out

typedef struct _ISCSI_SESSION ISCSI_SESSION

SNACK Request.

typedef struct _ISCSI_TCB ISCSI_TCB

iSCSI Task Managment Function Request.

iSCSI Task Management Function Response.

typedef struct _SCSI_COMMAND SCSI_COMMAND

SCSI Command

typedef struct _SCSI_RESPONSE SCSI_RESPONSE

SCSI Response


Enumeration Type Documentation

Enumerator:
DataIn 
DataOut 
DataBi 

Enumerator:
IScsiDigestNone 
IScsiDigestCRC32 


Function Documentation

EFI_STATUS IScsiAddKeyValuePair ( IN OUT NET_BUF *  Pdu,
IN CHAR8 *  Key,
IN CHAR8 *  Value 
)

Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU. The DataSegmentLength and the actual size of the net buffer containing this PDU will be updated.

Parameters:
[in,out] Pdu The iSCSI PDU whose data segment the key-value pair will be added to.
[in] Key The key name string.
[in] Value The value string.
Return values:
EFI_SUCCESS The key-valu pair is added to the PDU's datasegment and the correspondence length fields are updated.
EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value pair.
Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU. The DataSegmentLength and the actual size of the net buffer containing this PDU will be updated.

Parameters:
[in,out] Pdu The iSCSI PDU whose data segment the key-value pair will be added to.
[in] Key The key name string.
[in] Value The value string.
Return values:
EFI_SUCCESS The key-value pair is added to the PDU's data segment and the correspondence length fields are updated.
EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value pair.
EFI_PROTOCOL_ERROR There is no such data in the net buffer.

References _ISCSI_LOGIN_REQUEST::DataSegmentLength, ISCSI_SET_DATASEG_LEN, and NTOH24.

Referenced by IScsiCHAPToSendReq(), and IScsiFillOpParams().

VOID IScsiAttatchConnection ( IN OUT ISCSI_SESSION Session,
IN OUT ISCSI_CONNECTION Conn 
)

Attach the iSCSI connection to the iSCSI session.

Parameters:
[in,out] Session The iSCSI session.
[in,out] Conn The iSCSI connection.

Referenced by IScsiSessionLogin().

LIST_ENTRY* IScsiBuildKeyValueList ( IN CHAR8 *  Data,
IN UINT32  Len 
)

Build a key-value list from the data segment.

Parameters:
[in] Data The data segment containing the key-value pairs.
[in] Len Length of the data segment.
Returns:
The key-value list.
Return values:
NULL Other errors as indicated.

References IScsiFreeKeyValueList(), _ISCSI_KEY_VALUE_PAIR::Key, _ISCSI_KEY_VALUE_PAIR::List, and _ISCSI_KEY_VALUE_PAIR::Value.

Referenced by IScsiCHAPOnRspReceived(), IScsiCheckOpParams(), and IScsiUpdateTargetAddress().

EFI_STATUS IScsiCheckOpParams ( IN OUT ISCSI_CONNECTION Conn  ) 

EFI_STATUS IScsiConnLogin ( IN OUT ISCSI_CONNECTION Conn,
IN UINT16  Timeout 
)

This function performs the iSCSI connection login.

Parameters:
[in,out] Conn The iSCSI connection to login.
Timeout The timeout value in milliseconds.
Return values:
EFI_SUCCESS The iSCSI connection is logged into the iSCSI target.
EFI_TIMEOUT Timeout occurred during the login procedure.
Others Other errors as indicated.
This function does the iSCSI connection login.

Parameters:
[in,out] Conn The iSCSI connection to login.
Timeout The timeout value in millisecond.
Return values:
EFI_SUCCESS The iSCSI connection is logged into the iSCSI target.
EFI_TIMEOUT Timeout occurred during the login procedure.
Others Other errors as indicated.

References CONN_STATE_IN_LOGIN, ISCSI_FULL_FEATURE_PHASE, IScsiReceiveLoginRsp(), and IScsiSendLoginReq().

Referenced by IScsiSessionLogin().

ISCSI_CONNECTION* IScsiCreateConnection ( IN ISCSI_SESSION Session  ) 

VOID IScsiDestroyConnection ( IN ISCSI_CONNECTION Conn  ) 

Destroy an iSCSI connection.

Parameters:
[in] Conn The connection to destroy.

Referenced by IScsiSessionAbort(), and IScsiSessionLogin().

VOID IScsiDetatchConnection ( IN OUT ISCSI_CONNECTION Conn  ) 

Detach the iSCSI connection from the session it belongs to.

Parameters:
[in,out] Conn The iSCSI connection.

Referenced by IScsiSessionAbort(), and IScsiSessionLogin().

EFI_STATUS IScsiExecuteScsiCommand ( IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *  PassThru,
IN UINT8 *  Target,
IN UINT64  Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *  Packet 
)

Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.

Parameters:
[in] PassThru The EXT SCSI PASS THRU protocol.
[in] Target The target ID.
[in] Lun The LUN.
[in,out] Packet The request packet containing IO request, SCSI command buffer and buffers to read/write.
Return values:
EFI_SUCCES The SCSI command is executed and the result is updated to the Packet.
EFI_DEVICE_ERROR Session state was not as required.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NOT_READY The target can not accept new commands.
Others Other errors as indicated.
Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.

Parameters:
[in] PassThru The EXT SCSI PASS THRU protocol.
[in] Target The target ID.
[in] Lun The LUN.
[in,out] Packet The request packet containing IO request, SCSI command buffer and buffers to read/write.
Return values:
EFI_SUCCES The SCSI command is executed and the result is updated to the Packet.
EFI_DEVICE_ERROR Session state was not as required.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_PROTOCOL_ERROR There is no such data in the net buffer.
EFI_NOT_READY The target can not accept new commands.
Others Other errors as indicated.

References _ISCSI_SESSION::Conns, _ISCSI_XFER_CONTEXT::DesiredLength, _ISCSI_SESSION::FirstBurstLength, _ISCSI_IN_BUFFER_CONTEXT::InData, _ISCSI_IN_BUFFER_CONTEXT::InDataLen, _ISCSI_SESSION::InitialR2T, ISCSI_CONNECTION_SIGNATURE, ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU, ISCSI_GET_DATASEG_LEN, ISCSI_GET_OPCODE, ISCSI_OPCODE_NOP_IN, ISCSI_OPCODE_R2T, ISCSI_OPCODE_SCSI_DATA_IN, ISCSI_OPCODE_SCSI_RSP, ISCSI_OPCODE_VENDOR_T0, ISCSI_OPCODE_VENDOR_T1, ISCSI_OPCODE_VENDOR_T2, ISCSI_RESERVED_TAG, IScsiDelTcb(), IScsiNewScsiCmdPdu(), IScsiNewTcb(), IScsiOnDataInRcvd(), IScsiOnNopInRcvd(), IScsiOnR2TRcvd(), IScsiOnScsiRspRcvd(), IScsiReceivePdu(), IScsiSendDataOutPduSequence(), _ISCSI_XFER_CONTEXT::Offset, _ISCSI_DRIVER_DATA::Session, SESSION_STATE_LOGGED_IN, _ISCSI_SESSION::State, _ISCSI_TCB::StatusXferd, _ISCSI_XFER_CONTEXT::TargetTransferTag, _ISCSI_CONNECTION::TcpIo, _ISCSI_CONNECTION::TimeoutEvent, and _ISCSI_TCB::XferContext.

Referenced by IScsiExtScsiPassThruFunction().

VOID IScsiFillOpParams ( IN ISCSI_CONNECTION Conn,
IN OUT NET_BUF *  Pdu 
)

VOID IScsiFreeKeyValueList ( IN LIST_ENTRY *  KeyValueList  ) 

Free the key-value list.

Parameters:
[in] KeyValueList The key-value list.

Referenced by IScsiBuildKeyValueList(), IScsiCHAPOnRspReceived(), IScsiCheckOpParams(), and IScsiUpdateTargetAddress().

VOID EFIAPI IScsiFreeNbufList ( VOID *  Arg  ) 

The callback function to free the net buffer list.

Parameters:
[in] Arg The opaque parameter.

Referenced by IScsiGenerateDataOutPduSequence(), IScsiNewDataOutPdu(), IScsiNewScsiCmdPdu(), IScsiReceivePdu(), and IScsiSendDataOutPduSequence().

CHAR8* IScsiGetValueByKeyFromList ( IN OUT LIST_ENTRY *  KeyValueList,
IN CHAR8 *  Key 
)

Get the value string by the key name from the key-value list. If found, the key-value entry will be removed from the list.

Parameters:
[in,out] KeyValueList The key-value list.
[in] Key The key name to find.
Returns:
The value string.
Return values:
NULL The key value pair can not be found.
Get the value string by the key name from the key-value list. If found, the key-value entry will be removed from the list.

Parameters:
[in,out] KeyValueList The key-value list.
[in] Key The key name to find.
Returns:
The value string.
Return values:
NULL The key value pair cannot be found.

References _ISCSI_KEY_VALUE_PAIR::Key, _ISCSI_KEY_VALUE_PAIR::List, and _ISCSI_KEY_VALUE_PAIR::Value.

Referenced by IScsiCHAPOnRspReceived(), IScsiCheckOpParams(), and IScsiUpdateTargetAddress().

EFI_STATUS IScsiNormalizeName ( IN OUT CHAR8 *  Name,
IN UINTN  Len 
)

Normalize the iSCSI name according to RFC.

Parameters:
[in,out] Name The iSCSI name.
[in] Len length of the iSCSI name.
Return values:
EFI_SUCCESS The iSCSI name is valid and normalized.
EFI_PROTOCOL_ERROR The iSCSI name is mal-formatted or not in the IQN format.
Normalize the iSCSI name according to RFC.

Parameters:
[in,out] Name The iSCSI name.
[in] Len Length of the iSCSI name.
Return values:
EFI_SUCCESS The iSCSI name is valid and normalized.
EFI_PROTOCOL_ERROR The iSCSI name is malformatted or not in the IQN format.

Referenced by IScsiDhcp6ExtractRootPath(), IScsiDhcpExtractRootPath(), IScsiFormCallback(), and IScsiSetInitiatorName().

EFI_STATUS IScsiPadSegment ( IN OUT NET_BUF *  Pdu,
IN UINT32  Len 
)

Pad the iSCSI AHS or data segment to an integer number of 4 byte words.

Parameters:
[in,out] Pdu The iSCSI pdu which contains segments to pad.
[in] Len The length of the last semgnet in the PDU.
Return values:
EFI_SUCCESS The segment is padded or no need to pad it.
EFI_OUT_OF_RESOURCES There is not enough remaining free space to add the padding bytes.
Pad the iSCSI AHS or data segment to an integer number of 4 byte words.

Parameters:
[in,out] Pdu The iSCSI pdu which contains segments to pad.
[in] Len The length of the last segment in the PDU.
Return values:
EFI_SUCCESS The segment is padded or there is no need to pad it.
EFI_OUT_OF_RESOURCES There is not enough remaining free space to add the padding bytes.

References ISCSI_GET_PAD_LEN.

Referenced by IScsiPrepareLoginReq().

NET_BUF* IScsiPrepareLoginReq ( IN OUT ISCSI_CONNECTION Conn  ) 

EFI_STATUS IScsiProcessLoginRsp ( IN OUT ISCSI_CONNECTION Conn,
IN OUT NET_BUF *  Pdu 
)

Process the iSCSI Login Response.

Parameters:
[in,out] Conn The connection on which the iSCSI login response is received.
[in,out] Pdu The iSCSI login response PDU.
Return values:
EFI_SUCCESS The iSCSI login response PDU is processed and all check are passed.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
EFI_MEDIA_CHANGED Target is redirected.
Others Other errors as indicated.
Process the iSCSI Login Response.

Parameters:
[in,out] Conn The connection on which the iSCSI login response is received.
[in,out] Pdu The iSCSI login response PDU.
Return values:
EFI_SUCCESS The iSCSI login response PDU is processed, and all checks are passed.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error occurred.
EFI_MEDIA_CHANGED Target is redirected.
Others Other errors as indicated.

References _ISCSI_SESSION::AuthType, _ISCSI_SESSION::CmdSN, _ISCSI_SESSION::ExpCmdSN, _ISCSI_LOGIN_RESPONSE::ExpCmdSN, _ISCSI_SESSION::InitiatorTaskTag, _ISCSI_LOGIN_RESPONSE::InitiatorTaskTag, ISCSI_AUTH_INITIAL, ISCSI_AUTH_TYPE_KRB, ISCSI_CHECK_OPCODE, ISCSI_FLAG_ON, ISCSI_FULL_FEATURE_PHASE, ISCSI_GET_CURRENT_STAGE, ISCSI_GET_DATASEG_LEN, ISCSI_GET_NEXT_STAGE, ISCSI_LOGIN_OPERATIONAL_NEGOTIATION, ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE, ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT, ISCSI_LOGIN_STATUS_REDIRECTION, ISCSI_LOGIN_STATUS_SUCCESS, ISCSI_OPCODE_LOGIN_RSP, ISCSI_SECURITY_NEGOTIATION, IScsiCHAPOnRspReceived(), IScsiCheckOpParams(), IScsiCheckSN(), IScsiUpdateCmdSN(), IScsiUpdateTargetAddress(), _ISCSI_LOGIN_RESPONSE::Isid, _ISCSI_SESSION::Isid, _ISCSI_SESSION::MaxCmdSN, _ISCSI_LOGIN_RESPONSE::MaxCmdSN, SESSION_STATE_FREE, _ISCSI_SESSION::State, _ISCSI_LOGIN_RESPONSE::StatSN, _ISCSI_LOGIN_RESPONSE::StatusClass, _ISCSI_LOGIN_RESPONSE::Tsih, and _ISCSI_SESSION::Tsih.

Referenced by IScsiReceiveLoginRsp().

EFI_STATUS IScsiReceiveLoginRsp ( IN ISCSI_CONNECTION Conn  ) 

Receive and process the iSCSI login response.

Parameters:
[in] Conn The connection in the iSCSI login phase.
Return values:
EFI_SUCCESS The iSCSI login response PDU is received and processed.
Others Other errors as indicated.

References IScsiProcessLoginRsp(), and IScsiReceivePdu().

Referenced by IScsiConnLogin().

EFI_STATUS IScsiReceivePdu ( IN ISCSI_CONNECTION Conn,
OUT NET_BUF **  Pdu,
IN ISCSI_IN_BUFFER_CONTEXT Context,
IN BOOLEAN  HeaderDigest,
IN BOOLEAN  DataDigest,
IN EFI_EVENT  TimeoutEvent 
)

Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and an optional data segment. The two parts will be put into two blocks of buffers in the net buffer. The digest check will be conducted in this function if needed and the digests will be trimmed from the PDU buffer.

Parameters:
[in] Conn The iSCSI connection to receive data from.
[out] Pdu The received iSCSI pdu.
[in] Context The context used to describe information on the caller provided buffer to receive data segment of the iSCSI pdu, it's optional.
[in] HeaderDigest Whether there will be header digest received.
[in] DataDigest Whether there will be data digest.
[in] TimeoutEvent The timeout event, it's optional.
Return values:
EFI_SUCCESS An iSCSI pdu is received.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error occurred.
Others Other errors as indicated.
Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and an optional data segment. The two parts will be put into two blocks of buffers in the net buffer. The digest check will be conducted in this function if needed and the digests will be trimmed from the PDU buffer.

Parameters:
[in] Conn The iSCSI connection to receive data from.
[out] Pdu The received iSCSI pdu.
[in] Context The context used to describe information on the caller provided buffer to receive data segment of the iSCSI pdu. It is optional.
[in] HeaderDigest Whether there will be header digest received.
[in] DataDigest Whether there will be data digest.
[in] TimeoutEvent The timeout event. It is optional.
Return values:
EFI_SUCCESS An iSCSI pdu is received.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error occurred.
Others Other errors as indicated.

References ISCSI_GET_BUFFER_OFFSET, ISCSI_GET_DATASEG_LEN, ISCSI_GET_OPCODE, ISCSI_GET_PAD_LEN, ISCSI_OPCODE_ASYNC_MSG, ISCSI_OPCODE_LOGIN_RSP, ISCSI_OPCODE_NOP_IN, ISCSI_OPCODE_REJECT, ISCSI_OPCODE_SCSI_DATA_IN, ISCSI_OPCODE_SCSI_RSP, ISCSI_OPCODE_TEXT_RSP, ISCSI_OPCODE_VENDOR_T0, ISCSI_OPCODE_VENDOR_T1, ISCSI_OPCODE_VENDOR_T2, IScsiFreeNbufList(), and IScsiNbufExtFree().

Referenced by IScsiExecuteScsiCommand(), and IScsiReceiveLoginRsp().

EFI_STATUS IScsiSendLoginReq ( IN ISCSI_CONNECTION Conn  ) 

Build and send the iSCSI login request to the iSCSI target according to the current login stage.

Parameters:
[in] Conn The connection in the iSCSI login phase.
Return values:
EFI_SUCCESS The iSCSI login request PDU is built and sent on this connection.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_DEVICE_ERROR Some kind of device error happened.
Build and send the iSCSI login request to the iSCSI target according to the current login stage.

Parameters:
[in] Conn The connection in the iSCSI login phase.
Return values:
EFI_SUCCESS The iSCSI login request PDU is built and sent on this connection.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_DEVICE_ERROR Some kind of device error occurred.

References IScsiPrepareLoginReq().

Referenced by IScsiConnLogin().

VOID IScsiSessionAbort ( IN OUT ISCSI_SESSION Session  ) 

Abort the iSCSI session, that is, reset all the connection and free the resources.

Parameters:
[in,out] Session The iSCSI session.
Abort the iSCSI session. That is, reset all the connection(s), and free the resources.

Parameters:
[in,out] Session The iSCSI session.

References _ISCSI_CONNECTION::Ipv6Flag, ISCSI_CONNECTION_SIGNATURE, IScsiConnReset(), IScsiDestroyConnection(), IScsiDetatchConnection(), SESSION_STATE_FAILED, SESSION_STATE_LOGGED_IN, and _ISCSI_CONNECTION::TcpIo.

Referenced by IScsiOnExitBootService(), IScsiSessionReinstatement(), IScsiStart(), and IScsiStop().

VOID IScsiSessionInit ( IN OUT ISCSI_SESSION Session,
IN BOOLEAN  Recovery 
)

Initialize some session parameters before login.

Parameters:
[in,out] Session The iSCSI session.
[in] Recovery Whether the request is from a fresh new start or recovery.

References DEFAULT_MAX_OUTSTANDING_R2T, ISCSI_MAX_CONNS_PER_SESSION, ISCSI_SESSION_SIGNATURE, MAX_RECV_DATA_SEG_LEN_IN_FFP, and SESSION_STATE_FREE.

Referenced by IScsiSessionReinstatement(), and IScsiStart().

EFI_STATUS IScsiSessionLogin ( IN ISCSI_SESSION Session  ) 

Login the iSCSI session.

Parameters:
[in] Session The iSCSI session
Return values:
EFI_SUCCESS The iSCSI session login procedure finished.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NO_MEDIA There was a media error.
Others Other errors as indicated.
Login the iSCSI session.

Parameters:
[in] Session The iSCSI session.
Return values:
EFI_SUCCESS The iSCSI session login procedure finished.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NO_MEDIA There was a media error.
Others Other errors as indicated.

References _ISCSI_CONNECTION::Ipv6Flag, IScsiAttatchConnection(), IScsiConnLogin(), IScsiConnReset(), IScsiCreateConnection(), IScsiDestroyConnection(), IScsiDetatchConnection(), IScsiGetIp6NicInfo(), SESSION_STATE_LOGGED_IN, and _ISCSI_CONNECTION::TcpIo.

Referenced by IScsiSessionReinstatement(), IScsiSessionReLogin(), and IScsiStart().

EFI_STATUS IScsiSessionReinstatement ( IN ISCSI_SESSION Session  ) 

Reinstate the session on some error.

Parameters:
[in] Session The iSCSI session
Return values:
EFI_SUCCES The session is reinstated from some error.
Other Reinstatement failed.
Reinstate the session on some error.

Parameters:
[in] Session The iSCSI session
Return values:
EFI_SUCCESS The session is reinstated from some error.
Other Reinstatement failed.

References IScsiSessionAbort(), IScsiSessionInit(), IScsiSessionLogin(), and SESSION_STATE_FREE.

Referenced by IScsiExtScsiPassThruFunction().

EFI_STATUS IScsiSessionReLogin ( IN ISCSI_SESSION Session  ) 

Wait for IPsec negotiation, then try to login the iSCSI session again.

Parameters:
[in] Session The iSCSI session
Return values:
EFI_SUCCESS The iSCSI session login procedure finished.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
Wait for IPsec negotiation, then try to login the iSCSI session again.

Parameters:
[in] Session The iSCSI session.
Return values:
EFI_SUCCESS The iSCSI session login procedure finished.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error occurred.

References ISCSI_WAIT_IPSEC_TIMEOUT, and IScsiSessionLogin().

Referenced by IScsiStart().

EFI_STATUS IScsiUpdateTargetAddress ( IN OUT ISCSI_SESSION Session,
IN CHAR8 *  Data,
IN UINT32  Len 
)

Updated the target information according the data received in the iSCSI login response with an target redirection status.

Parameters:
[in,out] Session The iSCSI session.
[in] Data The data segment which should contain the TargetAddress key-value list.
[in] Len Length of the data.
Return values:
EFI_SUCCESS The target address is updated.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NOT_FOUND The TargetAddress key is not found.
Others Other errors as indicated.
Updated the target information according the data received in the iSCSI login response with an target redirection status.

Parameters:
[in,out] Session The iSCSI session.
[in] Data The data segment that should contain the TargetAddress key-value list.
[in] Len Length of the data.
Return values:
EFI_SUCCESS The target address is updated.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NOT_FOUND The TargetAddress key is not found.
Others Other errors as indicated.

References IP_MODE_AUTOCONFIG, IpMode, ISCSI_KEY_TARGET_ADDRESS, ISCSI_WELL_KNOWN_PORT, IScsiAsciiStrToIp(), IScsiBuildKeyValueList(), IScsiFreeKeyValueList(), and IScsiGetValueByKeyFromList().

Referenced by IScsiProcessLoginRsp().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1