NetworkPkg/IScsiDxe/IScsiProto.c File Reference


Functions

VOID IScsiAttatchConnection (IN OUT ISCSI_SESSION *Session, IN OUT ISCSI_CONNECTION *Conn)
VOID IScsiDetatchConnection (IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiCheckSN (IN OUT UINT32 *ExpSN, IN UINT32 NewSN)
VOID IScsiUpdateCmdSN (IN OUT ISCSI_SESSION *Session, IN UINT32 MaxCmdSN, IN UINT32 ExpCmdSN)
EFI_STATUS IScsiConnLogin (IN OUT ISCSI_CONNECTION *Conn, IN UINT16 Timeout)
VOID IScsiConnReset (IN OUT ISCSI_CONNECTION *Conn)
ISCSI_CONNECTIONIScsiCreateConnection (IN ISCSI_SESSION *Session)
VOID IScsiDestroyConnection (IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiGetIp6NicInfo (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)
VOID EFIAPI IScsiNbufExtFree (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 IScsiNewTcb (IN ISCSI_CONNECTION *Conn, OUT ISCSI_TCB **Tcb)
VOID IScsiDelTcb (IN ISCSI_TCB *Tcb)
ISCSI_TCBIScsiFindTcbByITT (IN LIST_ENTRY *TcbList, IN UINT32 InitiatorTaskTag)
NET_BUF * IScsiNewDataSegment (IN UINT8 *Data, IN UINT32 Len, IN BOOLEAN DataDigest)
NET_BUF * IScsiNewScsiCmdPdu (IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, IN UINT64 Lun, IN ISCSI_TCB *Tcb)
NET_BUF * IScsiNewDataOutPdu (IN UINT8 *Data, IN UINT32 Len, IN UINT32 DataSN, IN ISCSI_TCB *Tcb, IN UINT64 Lun)
LIST_ENTRY * IScsiGenerateDataOutPduSequence (IN UINT8 *Data, IN ISCSI_TCB *Tcb, IN UINT64 Lun)
EFI_STATUS IScsiSendDataOutPduSequence (IN UINT8 *Data, IN UINT64 Lun, IN ISCSI_TCB *Tcb)
EFI_STATUS IScsiOnDataInRcvd (IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
EFI_STATUS IScsiOnR2TRcvd (IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb, IN UINT64 Lun, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
EFI_STATUS IScsiOnScsiRspRcvd (IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
EFI_STATUS IScsiOnNopInRcvd (IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb)
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)

Variables

UINT32 mDataSegPad = 0

Detailed Description

The implementation of iSCSI protocol based on RFC3720.

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.


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-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 IScsiCheckSN ( IN OUT UINT32 *  ExpSN,
IN UINT32  NewSN 
)

Check the sequence number according to RFC3720.

Parameters:
[in,out] ExpSN The currently expected sequence number.
[in] NewSN The sequence number to check.
Return values:
EFI_SUCCESS The check passed and the ExpSN is increased.
EFI_NOT_READY Response was sent due to a retransmission request.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error occurred.

References ISCSI_SEQ_EQ, and ISCSI_SEQ_LT.

Referenced by IScsiOnDataInRcvd(), IScsiOnNopInRcvd(), IScsiOnR2TRcvd(), IScsiOnScsiRspRcvd(), and IScsiProcessLoginRsp().

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

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().

VOID IScsiConnReset ( IN OUT ISCSI_CONNECTION Conn  ) 

Reset the iSCSI connection.

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

Referenced by IScsiSessionAbort(), and IScsiSessionLogin().

ISCSI_CONNECTION* IScsiCreateConnection ( IN ISCSI_SESSION Session  ) 

VOID IScsiDelTcb ( IN ISCSI_TCB Tcb  ) 

Delete the tcb from the connection and destroy it.

Parameters:
[in] Tcb The tcb to delete.

Referenced by IScsiExecuteScsiCommand().

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_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 
)

ISCSI_TCB* IScsiFindTcbByITT ( IN LIST_ENTRY *  TcbList,
IN UINT32  InitiatorTaskTag 
)

Find the task control block by the initator task tag.

Parameters:
[in] TcbList The tcb list.
[in] InitiatorTaskTag The initiator task tag.
Returns:
The task control block found.
Return values:
NULL The task control block cannot be found.

References _ISCSI_TCB::InitiatorTaskTag.

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().

LIST_ENTRY* IScsiGenerateDataOutPduSequence ( IN UINT8 *  Data,
IN ISCSI_TCB Tcb,
IN UINT64  Lun 
)

Generate a consecutive sequence of iSCSI SCSI Data Out PDUs.

Parameters:
[in] Data The data which will be carried by the sequence of iSCSI SCSI Data Out PDUs.
[in] Tcb The task control block of the data to send out.
[in] Lun The LUN the data will be sent to.
Returns:
A list of net buffers with each of them wrapping an iSCSI SCSI Data Out PDU.
Return values:
NULL Other errors as indicated.

References _ISCSI_XFER_CONTEXT::DesiredLength, ISCSI_BHS_FLAG_FINAL, ISCSI_SET_FLAG, IScsiFreeNbufList(), IScsiNewDataOutPdu(), _ISCSI_CONNECTION::MaxRecvDataSegmentLength, and _ISCSI_XFER_CONTEXT::Offset.

Referenced by IScsiSendDataOutPduSequence().

EFI_STATUS IScsiGetIp6NicInfo ( IN ISCSI_CONNECTION Conn  ) 

Retrieve the IPv6 Address/Prefix/Gateway from the established TCP connection, these informations will be filled in the iSCSI Boot Firmware Table.

Parameters:
[in] Conn The connection used in the iSCSI login phase.
Return values:
EFI_SUCCESS Get the NIC information successfully.
Others Other errors as indicated.

References _ISCSI_SESSION_CONFIG_NVDATA::Gateway, _ISCSI_SESSION_CONFIG_NVDATA::LocalIp, _ISCSI_SESSION_CONFIG_NVDATA::PrefixLength, and _ISCSI_SESSION_CONFIG_NVDATA::TargetIp.

Referenced by IScsiSessionLogin().

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 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().

VOID EFIAPI IScsiNbufExtFree ( VOID *  Arg  ) 

The callback function called in NetBufFree; it does nothing.

Parameters:
[in] Arg The opaque parameter.

Referenced by IScsiNewDataSegment(), and IScsiReceivePdu().

NET_BUF* IScsiNewDataOutPdu ( IN UINT8 *  Data,
IN UINT32  Len,
IN UINT32  DataSN,
IN ISCSI_TCB Tcb,
IN UINT64  Lun 
)

Create a new iSCSI SCSI Data Out PDU.

Parameters:
[in] Data The data to put into the Data Out PDU.
[in] Len Length of the data.
[in] DataSN The DataSN of the Data Out PDU.
[in] Tcb The task control block of this Data Out PDU.
[in] Lun The LUN.
Returns:
The net buffer wrapping the Data Out PDU.
Return values:
NULL Other errors as indicated.

References _ISCSI_SCSI_DATA_OUT::BufferOffset, _ISCSI_SCSI_DATA_OUT::DataSN, _ISCSI_SCSI_DATA_OUT::ExpStatSN, _ISCSI_SCSI_DATA_OUT::InitiatorTaskTag, ISCSI_OPCODE_SCSI_DATA_OUT, ISCSI_RESERVED_TAG, ISCSI_SET_DATASEG_LEN, ISCSI_SET_OPCODE, IScsiFreeNbufList(), IScsiNewDataSegment(), _ISCSI_SCSI_DATA_OUT::Lun, _ISCSI_XFER_CONTEXT::Offset, _ISCSI_XFER_CONTEXT::TargetTransferTag, and _ISCSI_SCSI_DATA_OUT::TargetTransferTag.

Referenced by IScsiGenerateDataOutPduSequence().

NET_BUF* IScsiNewDataSegment ( IN UINT8 *  Data,
IN UINT32  Len,
IN BOOLEAN  DataDigest 
)

Create a data segment, pad it, and calculate the CRC if needed.

Parameters:
[in] Data The data to fill into the data segment.
[in] Len Length of the data.
[in] DataDigest Whether to calculate CRC for this data segment.
Returns:
The net buffer wrapping the data segment.

References ISCSI_GET_PAD_LEN, IScsiNbufExtFree(), and mDataSegPad.

Referenced by IScsiNewDataOutPdu(), and IScsiNewScsiCmdPdu().

NET_BUF* IScsiNewScsiCmdPdu ( IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *  Packet,
IN UINT64  Lun,
IN ISCSI_TCB Tcb 
)

EFI_STATUS IScsiNewTcb ( IN ISCSI_CONNECTION Conn,
OUT ISCSI_TCB **  Tcb 
)

Create an iSCSI task control block.

Parameters:
[in] Conn The connection on which the task control block will be created.
[out] Tcb The newly created task control block.
Return values:
EFI_SUCCESS The task control block is created.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_NOT_READY The target cannot accept new commands.

References _ISCSI_TCB::CmdSN, _ISCSI_SESSION::CmdSN, _ISCSI_TCB::Conn, _ISCSI_SESSION::InitiatorTaskTag, _ISCSI_TCB::InitiatorTaskTag, ISCSI_SEQ_GT, _ISCSI_TCB::Link, _ISCSI_SESSION::MaxCmdSN, _ISCSI_TCB::SoFarInOrder, and _ISCSI_SESSION::TcbList.

Referenced by IScsiExecuteScsiCommand().

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 malformatted or not in the IQN format.

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

EFI_STATUS IScsiOnDataInRcvd ( IN NET_BUF *  Pdu,
IN ISCSI_TCB Tcb,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *  Packet 
)

Process the received iSCSI SCSI Data In PDU.

Parameters:
[in] Pdu The Data In PDU received.
[in] Tcb The task control block.
[in,out] Packet The EXT SCSI PASS THRU request packet.
Return values:
EFI_SUCCES The check on the Data IN PDU is passed and some update actions are taken.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror occurred.
EFI_BAD_BUFFER_SIZEE The buffer was not the proper size for the request.
Others Other errors as indicated.

References _ISCSI_SCSI_DATA_IN::DataSN, _ISCSI_SCSI_DATA_IN::ExpCmdSN, _ISCSI_SCSI_DATA_IN::InitiatorTaskTag, ISCSI_BHS_FLAG_FINAL, ISCSI_FLAG_ON, IScsiCheckSN(), IScsiUpdateCmdSN(), _ISCSI_SCSI_DATA_IN::MaxCmdSN, _ISCSI_SCSI_DATA_IN::ResidualCount, SCSI_DATA_IN_PDU_FLAG_OVERFLOW, SCSI_DATA_IN_PDU_FLAG_STATUS_VALID, SCSI_DATA_IN_PDU_FLAG_UNDERFLOW, SCSI_RSP_PDU_FLAG_OVERFLOW, SCSI_RSP_PDU_FLAG_UNDERFLOW, _ISCSI_SCSI_DATA_IN::StatSN, and _ISCSI_SCSI_DATA_IN::Status.

Referenced by IScsiExecuteScsiCommand().

EFI_STATUS IScsiOnNopInRcvd ( IN NET_BUF *  Pdu,
IN ISCSI_TCB Tcb 
)

Process the received NOP In PDU.

Parameters:
[in] Pdu The NOP In PDU received.
[in] Tcb The task control block.
Return values:
EFI_SUCCES The NOP In PDU is processed and the related sequence numbers are updated.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror occurred.

References _ISCSI_NOP_IN::ExpCmdSN, _ISCSI_NOP_IN::InitiatorTaskTag, ISCSI_RESERVED_TAG, IScsiCheckSN(), IScsiUpdateCmdSN(), _ISCSI_NOP_IN::MaxCmdSN, and _ISCSI_NOP_IN::StatSN.

Referenced by IScsiExecuteScsiCommand().

EFI_STATUS IScsiOnR2TRcvd ( IN NET_BUF *  Pdu,
IN ISCSI_TCB Tcb,
IN UINT64  Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *  Packet 
)

Process the received iSCSI R2T PDU.

Parameters:
[in] Pdu The R2T PDU received.
[in] Tcb The task control block.
[in] Lun The Lun.
[in,out] Packet The EXT SCSI PASS THRU request packet.
Return values:
EFI_SUCCES The R2T PDU is valid and the solicited data is sent out.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror occurred.
Others Other errors as indicated.

References _ISCSI_READY_TO_TRANSFER::BufferOffset, _ISCSI_READY_TO_TRANSFER::DesiredDataTransferLength, _ISCSI_XFER_CONTEXT::DesiredLength, _ISCSI_READY_TO_TRANSFER::InitiatorTaskTag, ISCSI_SEQ_EQ, IScsiCheckSN(), IScsiSendDataOutPduSequence(), _ISCSI_XFER_CONTEXT::Offset, _ISCSI_READY_TO_TRANSFER::R2TSeqNum, _ISCSI_READY_TO_TRANSFER::StatSN, _ISCSI_XFER_CONTEXT::TargetTransferTag, and _ISCSI_READY_TO_TRANSFER::TargetTransferTag.

Referenced by IScsiExecuteScsiCommand().

EFI_STATUS IScsiOnScsiRspRcvd ( IN NET_BUF *  Pdu,
IN ISCSI_TCB Tcb,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *  Packet 
)

Process the received iSCSI SCSI Response PDU.

Parameters:
[in] Pdu The Response PDU received.
[in] Tcb The task control block.
[in,out] Packet The EXT SCSI PASS THRU request packet.
Return values:
EFI_SUCCES The Response PDU is processed.
EFI_PROTOCOL_ERROR Some kind of iSCSI protocol errror occurred.
EFI_BAD_BUFFER_SIZEE The buffer was not the proper size for the request.
Others Other errors as indicated.

References _SCSI_RESPONSE::BiReadResidualCount, _ISCSI_SENSE_DATA::Data, DataIn, _SCSI_RESPONSE::ExpCmdSN, _SCSI_RESPONSE::InitiatorTaskTag, ISCSI_FLAG_ON, ISCSI_GET_DATASEG_LEN, ISCSI_SERVICE_RSP_COMMAND_COMPLETE_AT_TARGET, IScsiCheckSN(), IScsiUpdateCmdSN(), _ISCSI_SENSE_DATA::Length, _SCSI_RESPONSE::MaxCmdSN, _SCSI_RESPONSE::ResidualCount, _SCSI_RESPONSE::Response, SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW, SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW, SCSI_RSP_PDU_FLAG_OVERFLOW, SCSI_RSP_PDU_FLAG_UNDERFLOW, _SCSI_RESPONSE::StatSN, and _SCSI_RESPONSE::Status.

Referenced by IScsiExecuteScsiCommand().

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 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 
)

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 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 IScsiSendDataOutPduSequence ( IN UINT8 *  Data,
IN UINT64  Lun,
IN ISCSI_TCB Tcb 
)

Send the Data in a sequence of Data Out PDUs one by one.

Parameters:
[in] Data The data to carry by Data Out PDUs.
[in] Lun The LUN the data will be sent to.
[in] Tcb The task control block.
Return values:
EFI_SUCCES The data is sent out to the LUN.
EFI_OUT_OF_RESOURCES Failed to allocate memory.
Others Other errors as indicated.

References IScsiFreeNbufList(), and IScsiGenerateDataOutPduSequence().

Referenced by IScsiExecuteScsiCommand(), and IScsiOnR2TRcvd().

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 occurred.

References IScsiPrepareLoginReq().

Referenced by IScsiConnLogin().

VOID IScsiSessionAbort ( IN OUT ISCSI_SESSION 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.

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_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 occurred.

References ISCSI_WAIT_IPSEC_TIMEOUT, and IScsiSessionLogin().

Referenced by IScsiStart().

VOID IScsiUpdateCmdSN ( IN OUT ISCSI_SESSION Session,
IN UINT32  MaxCmdSN,
IN UINT32  ExpCmdSN 
)

Update the sequence numbers for the iSCSI command.

Parameters:
[in,out] Session The iSCSI session.
[in] MaxCmdSN Maximum CmdSN from the target.
[in] ExpCmdSN Next expected CmdSN from the target.

References ISCSI_SEQ_GT, and ISCSI_SEQ_LT.

Referenced by IScsiOnDataInRcvd(), IScsiOnNopInRcvd(), IScsiOnScsiRspRcvd(), and IScsiProcessLoginRsp().

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 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().


Variable Documentation

UINT32 mDataSegPad = 0

Referenced by IScsiNewDataSegment().


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