11UINT32 mDataSegPad = 0;
27 Conn->Session = Session;
43 Conn->Session->NumConns--;
64 if (!ISCSI_SEQ_EQ (NewSN, *ExpSN)) {
65 if (ISCSI_SEQ_LT (NewSN, *ExpSN)) {
71 return EFI_PROTOCOL_ERROR;
97 if (ISCSI_SEQ_LT (MaxCmdSN, ExpCmdSN - 1)) {
101 if (ISCSI_SEQ_GT (MaxCmdSN, Session->MaxCmdSN)) {
102 Session->MaxCmdSN = MaxCmdSN;
105 if (ISCSI_SEQ_GT (ExpCmdSN, Session->ExpCmdSN)) {
106 Session->ExpCmdSN = ExpCmdSN;
132 Status =
gBS->SetTimer (
137 if (EFI_ERROR (Status)) {
144 Status =
TcpIoConnect (&Conn->TcpIo, Conn->TimeoutEvent);
147 if (EFI_ERROR (Status)) {
151 Conn->State = CONN_STATE_IN_LOGIN;
158 if (EFI_ERROR (Status)) {
163 if (EFI_ERROR (Status)) {
166 }
while (Conn->CurrentStage != ISCSI_FULL_FEATURE_PHASE);
206 Private = Session->Private;
207 NvData = &Session->ConfigData->SessionConfigData;
214 Conn->Signature = ISCSI_CONNECTION_SIGNATURE;
216 Conn->CurrentStage = ISCSI_SECURITY_NEGOTIATION;
217 Conn->NextStage = ISCSI_LOGIN_OPERATIONAL_NEGOTIATION;
218 Conn->AuthStep = ISCSI_AUTH_INITIAL;
220 Conn->PartialReqSent =
FALSE;
221 Conn->PartialRspRcvd =
FALSE;
222 Conn->ParamNegotiated =
FALSE;
223 Conn->Cid = Session->NextCid++;
224 Conn->Ipv6Flag = NvData->IpMode == IP_MODE_IP6 || Session->ConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6;
226 Status =
gBS->CreateEvent (
233 if (EFI_ERROR (Status)) {
243 Conn->MaxRecvDataSegmentLength = DEFAULT_MAX_RECV_DATA_SEG_LEN;
244 Conn->HeaderDigest = IScsiDigestNone;
245 Conn->DataDigest = IScsiDigestNone;
247 if (NvData->DnsMode) {
251 if (!Conn->Ipv6Flag) {
252 Status =
IScsiDns4 (Private->Image, Private->Controller, NvData);
254 Status =
IScsiDns6 (Private->Image, Private->Controller, NvData);
257 if (EFI_ERROR (Status)) {
258 DEBUG ((DEBUG_ERROR,
"The configuration of Target address or DNS server address is invalid!\n"));
264 if (!Conn->Ipv6Flag) {
265 Tcp4IoConfig = &TcpIoConfig.Tcp4IoConfigData;
272 Tcp4IoConfig->RemotePort = NvData->TargetPort;
273 Tcp4IoConfig->ActiveFlag =
TRUE;
274 Tcp4IoConfig->StationPort = 0;
276 Tcp6IoConfig = &TcpIoConfig.Tcp6IoConfigData;
279 Tcp6IoConfig->RemotePort = NvData->TargetPort;
280 Tcp6IoConfig->ActiveFlag =
TRUE;
281 Tcp6IoConfig->StationPort = 0;
290 (UINT8)(!Conn->Ipv6Flag ? TCP_VERSION_4 : TCP_VERSION_6),
294 if (EFI_ERROR (Status)) {
295 gBS->CloseEvent (Conn->TimeoutEvent);
317 gBS->CloseEvent (Conn->TimeoutEvent);
342 UINT8 SubnetPrefixLength;
345 NvData = &Conn->Session->ConfigData->SessionConfigData;
346 TargetIp = &NvData->TargetIp.v6;
347 Tcp6 = Conn->TcpIo.Tcp.Tcp6;
350 Status = Tcp6->GetModeData (
358 if (EFI_ERROR (Status)) {
363 Status = EFI_ABORTED;
369 NvData->PrefixLength = 0;
370 for (Index = 0; Index < Ip6ModeData.
AddressCount; Index++) {
377 SubnetPrefixLength = 0;
379 for (Index = 0; Index < Ip6ModeData.
RouteCount; Index++) {
389 IP6_COPY_ADDRESS (&NvData->Gateway, &Ip6ModeData.
RouteTable[RouteEntry].
Gateway);
435 if (Session->AuthType == ISCSI_AUTH_TYPE_CHAP) {
436 Session->AuthData.CHAP.Hash =
NULL;
475 CopyMem (Session->Isid, Session->ConfigData->SessionConfigData.IsId, 6);
485 return EFI_OUT_OF_RESOURCES;
494 Status =
IScsiConnLogin (Conn, Session->ConfigData->SessionConfigData.ConnectTimeout);
495 if (EFI_ERROR (Status)) {
501 if (Status != EFI_TIMEOUT) {
506 }
while (RetryCount <= Session->ConfigData->SessionConfigData.ConnectRetryCount);
508 if (!EFI_ERROR (Status)) {
509 Session->State = SESSION_STATE_LOGGED_IN;
511 if (!Conn->Ipv6Flag) {
512 ProtocolGuid = &gEfiTcp4ProtocolGuid;
514 ProtocolGuid = &gEfiTcp6ProtocolGuid;
517 Status =
gBS->OpenProtocol (
521 Session->Private->Image,
522 Session->Private->ExtScsiPassThruHandle,
523 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
528 if (Conn->Ipv6Flag) {
555 Status =
gBS->CreateEvent (EVT_TIMER, TPL_CALLBACK,
NULL,
NULL, &Timer);
556 if (EFI_ERROR (Status)) {
560 Status =
gBS->SetTimer (
566 if (EFI_ERROR (Status)) {
567 gBS->CloseEvent (Timer);
572 TimerStatus =
gBS->CheckEvent (Timer);
574 if (!EFI_ERROR (TimerStatus)) {
577 }
while (TimerStatus == EFI_NOT_READY);
579 gBS->CloseEvent (Timer);
608 return EFI_DEVICE_ERROR;
644 if (EFI_ERROR (Status)) {
648 ASSERT (Pdu !=
NULL);
691 if (LoginReq ==
NULL) {
692 return EFI_PROTOCOL_ERROR;
695 DataSegLen = NTOH24 (LoginReq->DataSegmentLength);
704 TotalLen = KeyLen + 1 + ValueLen + 1;
711 return EFI_OUT_OF_RESOURCES;
726 CopyMem (Data, Value, ValueLen);
734 ISCSI_SET_DATASEG_LEN (LoginReq, DataSegLen + TotalLen);
758 Session = Conn->Session;
766 if (LoginReq ==
NULL) {
776 ISCSI_SET_OPCODE (LoginReq, ISCSI_OPCODE_LOGIN_REQ, ISCSI_REQ_IMMEDIATE);
777 ISCSI_SET_STAGES (LoginReq, Conn->CurrentStage, Conn->NextStage);
778 LoginReq->VersionMax = ISCSI_VERSION_MAX;
779 LoginReq->VersionMin = ISCSI_VERSION_MIN;
780 LoginReq->Tsih = HTONS (Session->Tsih);
781 LoginReq->InitiatorTaskTag = HTONL (Session->InitiatorTaskTag);
782 LoginReq->Cid = HTONS (Conn->Cid);
783 LoginReq->CmdSN = HTONL (Session->CmdSN);
792 LoginReq->ExpStatSN = HTONL (Conn->ExpStatSN);
793 CopyMem (LoginReq->Isid, Session->Isid, sizeof (LoginReq->Isid));
795 if (Conn->PartialRspRcvd) {
804 switch (Conn->CurrentStage) {
805 case ISCSI_SECURITY_NEGOTIATION:
810 if (Session->AuthType != ISCSI_AUTH_TYPE_KRB) {
816 case ISCSI_LOGIN_OPERATIONAL_NEGOTIATION:
820 if (!Conn->ParamNegotiated) {
824 ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
831 Status = EFI_DEVICE_ERROR;
835 if (EFI_ERROR (Status)) {
846 Conn->TransitInitiated = ISCSI_FLAG_ON (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
881 Session = Conn->Session;
884 if (LoginRsp ==
NULL) {
885 return EFI_PROTOCOL_ERROR;
888 if (!ISCSI_CHECK_OPCODE (LoginRsp, ISCSI_OPCODE_LOGIN_RSP)) {
892 return EFI_PROTOCOL_ERROR;
898 DataSegLen = ISCSI_GET_DATASEG_LEN (LoginRsp);
899 if (DataSegLen != 0) {
908 switch (LoginRsp->StatusClass) {
909 case ISCSI_LOGIN_STATUS_SUCCESS:
915 case ISCSI_LOGIN_STATUS_REDIRECTION:
919 if (DataSeg ==
NULL) {
920 return EFI_PROTOCOL_ERROR;
928 if (EFI_ERROR (Status)) {
936 return EFI_MEDIA_CHANGED;
942 return EFI_PROTOCOL_ERROR;
948 Transit = ISCSI_FLAG_ON (LoginRsp, ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT);
949 Continue = ISCSI_FLAG_ON (LoginRsp, ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE);
951 CurrentStage = ISCSI_GET_CURRENT_STAGE (LoginRsp);
952 NextStage = ISCSI_GET_NEXT_STAGE (LoginRsp);
954 LoginRsp->InitiatorTaskTag = NTOHL (LoginRsp->InitiatorTaskTag);
956 if ((Transit && Continue) ||
957 (CurrentStage != Conn->CurrentStage) ||
958 (!Conn->TransitInitiated && Transit) ||
959 (Transit && (NextStage != Conn->NextStage)) ||
960 (
CompareMem (Session->Isid, LoginRsp->Isid, sizeof (LoginRsp->Isid)) != 0) ||
961 (LoginRsp->InitiatorTaskTag != Session->InitiatorTaskTag)
972 return EFI_PROTOCOL_ERROR;
975 LoginRsp->StatSN = NTOHL (LoginRsp->StatSN);
976 LoginRsp->ExpCmdSN = NTOHL (LoginRsp->ExpCmdSN);
977 LoginRsp->MaxCmdSN = NTOHL (LoginRsp->MaxCmdSN);
979 if ((Conn->CurrentStage == ISCSI_SECURITY_NEGOTIATION) && (Conn->AuthStep == ISCSI_AUTH_INITIAL)) {
984 if ((Session->State ==
SESSION_STATE_FREE) && (Session->CmdSN != LoginRsp->ExpCmdSN)) {
985 return EFI_PROTOCOL_ERROR;
992 Conn->ExpStatSN = LoginRsp->StatSN + 1;
993 Session->MaxCmdSN = LoginRsp->MaxCmdSN;
994 Session->ExpCmdSN = LoginRsp->ExpCmdSN;
999 Status =
IScsiCheckSN (&Conn->ExpStatSN, LoginRsp->StatSN);
1000 if (!EFI_ERROR (Status)) {
1023 Conn->PartialRspRcvd = Continue;
1032 switch (CurrentStage) {
1033 case ISCSI_SECURITY_NEGOTIATION:
1037 if (Session->AuthType != ISCSI_AUTH_TYPE_KRB) {
1043 case ISCSI_LOGIN_OPERATIONAL_NEGOTIATION:
1048 if (!EFI_ERROR (Status)) {
1049 Conn->ParamNegotiated =
TRUE;
1058 Status = EFI_PROTOCOL_ERROR;
1066 Conn->CurrentStage = Conn->NextStage;
1068 if (Conn->CurrentStage == ISCSI_LOGIN_OPERATIONAL_NEGOTIATION) {
1069 Conn->NextStage = ISCSI_FULL_FEATURE_PHASE;
1075 Session->Tsih = NTOHS (LoginRsp->Tsih);
1110 CHAR8 *TargetAddress;
1118 if (KeyValueList ==
NULL) {
1119 return EFI_OUT_OF_RESOURCES;
1122 Status = EFI_NOT_FOUND;
1123 NvData = &Session->ConfigData->SessionConfigData;
1127 if (TargetAddress ==
NULL) {
1136 if (NET_IS_DIGIT (TargetAddress[0])) {
1140 IpStr = TargetAddress;
1142 while ((*TargetAddress !=
'\0') && (*TargetAddress !=
':') && (*TargetAddress !=
',')) {
1148 }
else if (*TargetAddress == ISCSI_REDIRECT_ADDR_START_DELIMITER) {
1153 IpStr = TargetAddress;
1154 while ((*TargetAddress !=
'\0') && (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER)) {
1161 if (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER) {
1165 *TargetAddress =
'\0';
1171 IpStr = TargetAddress;
1173 while ((*TargetAddress !=
'\0') && (*TargetAddress !=
':') && (*TargetAddress !=
',')) {
1177 NvData->DnsMode =
TRUE;
1183 NvData->OriginalTargetPort = NvData->TargetPort;
1185 if (*TargetAddress ==
',') {
1191 }
else if (*TargetAddress ==
':') {
1192 *TargetAddress =
'\0';
1197 if (Number > 0xFFFF) {
1200 NvData->TargetPort = (UINT16)Number;
1206 NvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
1217 if (NvData->IpMode < IP_MODE_AUTOCONFIG) {
1218 IpMode = NvData->IpMode;
1220 IpMode = Session->ConfigData->AutoConfigureMode;
1223 if (NvData->DnsMode) {
1228 if (
AsciiStrSize (IpStr) >
sizeof (Session->ConfigData->SessionConfigData.TargetUrl)) {
1229 return EFI_INVALID_PARAMETER;
1237 &Session->ConfigData->SessionConfigData.TargetIp
1240 if (EFI_ERROR (Status)) {
1243 NvData->RedirectFlag =
TRUE;
1266 ASSERT (Arg !=
NULL);
1311 IN BOOLEAN HeaderDigest,
1312 IN BOOLEAN DataDigest,
1322 UINT32 InDataOffset;
1324 UINT32 FragmentCount;
1326 UINT32 PadAndCRC32[2];
1329 if (NbufList ==
NULL) {
1330 return EFI_OUT_OF_RESOURCES;
1340 if (PduHdr ==
NULL) {
1341 Status = EFI_OUT_OF_RESOURCES;
1346 if (Header ==
NULL) {
1347 Status = EFI_OUT_OF_RESOURCES;
1358 if (EFI_ERROR (Status)) {
1369 NetbufTrim (PduHdr,
sizeof (UINT32), NET_BUF_TAIL);
1372 Len = ISCSI_GET_DATASEG_LEN (Header);
1383 PadLen = ISCSI_GET_PAD_LEN (Len);
1385 switch (ISCSI_GET_OPCODE (Header)) {
1386 case ISCSI_OPCODE_SCSI_DATA_IN:
1391 InDataOffset = ISCSI_GET_BUFFER_OFFSET (Header);
1392 if ((Context ==
NULL) || ((InDataOffset + Len) > Context->InDataLen)) {
1393 Status = EFI_PROTOCOL_ERROR;
1397 Fragment[0].Len = Len;
1398 Fragment[0].Bulk = Context->InData + InDataOffset;
1400 if (DataDigest || (PadLen != 0)) {
1405 Fragment[1].Len = PadLen + (DataDigest ?
sizeof (UINT32) : 0);
1406 Fragment[1].Bulk = (UINT8 *)PadAndCRC32 + (4 - PadLen);
1414 if (DataSeg ==
NULL) {
1415 Status = EFI_OUT_OF_RESOURCES;
1421 case ISCSI_OPCODE_SCSI_RSP:
1422 case ISCSI_OPCODE_NOP_IN:
1423 case ISCSI_OPCODE_LOGIN_RSP:
1424 case ISCSI_OPCODE_TEXT_RSP:
1425 case ISCSI_OPCODE_ASYNC_MSG:
1426 case ISCSI_OPCODE_REJECT:
1427 case ISCSI_OPCODE_VENDOR_T0:
1428 case ISCSI_OPCODE_VENDOR_T1:
1429 case ISCSI_OPCODE_VENDOR_T2:
1433 Len += PadLen + (DataDigest ?
sizeof (UINT32) : 0);
1435 if (DataSeg ==
NULL) {
1436 Status = EFI_OUT_OF_RESOURCES;
1444 Status = EFI_PROTOCOL_ERROR;
1455 if (EFI_ERROR (Status)) {
1463 NetbufTrim (DataSeg,
sizeof (UINT32), NET_BUF_TAIL);
1479 Status = EFI_OUT_OF_RESOURCES;
1484 if (EFI_ERROR (Status)) {
1517 ASSERT (Conn->RspQue.BufNum != 0);
1519 Session = Conn->Session;
1521 Len = Conn->RspQue.BufSize;
1524 return EFI_OUT_OF_RESOURCES;
1529 Status = EFI_PROTOCOL_ERROR;
1535 if (KeyValueList ==
NULL) {
1544 if (Value ==
NULL) {
1549 if (Conn->HeaderDigest != IScsiDigestCRC32) {
1552 }
else if (
AsciiStrCmp (Value, ISCSI_KEY_VALUE_NONE) == 0) {
1553 Conn->HeaderDigest = IScsiDigestNone;
1562 if (Value ==
NULL) {
1567 if (Conn->DataDigest != IScsiDigestCRC32) {
1570 }
else if (
AsciiStrCmp (Value, ISCSI_KEY_VALUE_NONE) == 0) {
1571 Conn->DataDigest = IScsiDigestNone;
1580 if (Value ==
NULL) {
1585 if (NumericValue > 2) {
1589 Session->ErrorRecoveryLevel = (UINT8)
MIN (Session->ErrorRecoveryLevel, NumericValue);
1594 if (!Session->InitialR2T) {
1596 if (Value ==
NULL) {
1600 Session->InitialR2T = (BOOLEAN)(
AsciiStrCmp (Value,
"Yes") == 0);
1607 if (Value ==
NULL) {
1611 Session->ImmediateData = (BOOLEAN)(Session->ImmediateData && (BOOLEAN)(
AsciiStrCmp (Value,
"Yes") == 0));
1617 if (Value !=
NULL) {
1618 Conn->MaxRecvDataSegmentLength = (UINT32)
IScsiNetNtoi (Value);
1625 if (Value ==
NULL) {
1630 Session->MaxBurstLength = (UINT32)
MIN (Session->MaxBurstLength, NumericValue);
1636 if (!(Session->InitialR2T && !Session->ImmediateData)) {
1638 if (Value ==
NULL) {
1643 Session->FirstBurstLength = (UINT32)
MIN (Session->FirstBurstLength, NumericValue);
1650 if (Value ==
NULL) {
1655 if ((NumericValue == 0) || (NumericValue > 65535)) {
1659 Session->MaxConnections = (UINT32)
MIN (Session->MaxConnections, NumericValue);
1664 if (!Session->DataPDUInOrder) {
1666 if (Value ==
NULL) {
1670 Session->DataPDUInOrder = (BOOLEAN)(
AsciiStrCmp (Value,
"Yes") == 0);
1676 if (!Session->DataSequenceInOrder) {
1678 if (Value ==
NULL) {
1682 Session->DataSequenceInOrder = (BOOLEAN)(
AsciiStrCmp (Value,
"Yes") == 0);
1689 if (Value ==
NULL) {
1694 if (NumericValue == 0) {
1695 Session->DefaultTime2Wait = 0;
1696 }
else if (NumericValue > 3600) {
1699 Session->DefaultTime2Wait = (UINT32)
MAX (Session->DefaultTime2Wait, NumericValue);
1706 if (Value ==
NULL) {
1711 if (NumericValue == 0) {
1712 Session->DefaultTime2Retain = 0;
1713 }
else if (NumericValue > 3600) {
1716 Session->DefaultTime2Retain = (UINT32)
MIN (Session->DefaultTime2Retain, NumericValue);
1723 if (Value ==
NULL) {
1728 if ((NumericValue == 0) || (NumericValue > 65535)) {
1732 Session->MaxOutstandingR2T = (UINT16)
MIN (Session->MaxOutstandingR2T, NumericValue);
1751 if (Session->InitialR2T && !Session->ImmediateData) {
1787 Session = Conn->Session;
1789 AsciiSPrint (Value,
sizeof (Value),
"%a", (Conn->HeaderDigest == IScsiDigestCRC32) ?
"None,CRC32" :
"None");
1792 AsciiSPrint (Value,
sizeof (Value),
"%a", (Conn->DataDigest == IScsiDigestCRC32) ?
"None,CRC32" :
"None");
1795 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->ErrorRecoveryLevel);
1798 AsciiSPrint (Value,
sizeof (Value),
"%a", Session->InitialR2T ?
"Yes" :
"No");
1801 AsciiSPrint (Value,
sizeof (Value),
"%a", Session->ImmediateData ?
"Yes" :
"No");
1804 AsciiSPrint (Value,
sizeof (Value),
"%d", MAX_RECV_DATA_SEG_LEN_IN_FFP);
1807 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->MaxBurstLength);
1810 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->FirstBurstLength);
1813 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->MaxConnections);
1816 AsciiSPrint (Value,
sizeof (Value),
"%a", Session->DataPDUInOrder ?
"Yes" :
"No");
1819 AsciiSPrint (Value,
sizeof (Value),
"%a", Session->DataSequenceInOrder ?
"Yes" :
"No");
1822 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->DefaultTime2Wait);
1825 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->DefaultTime2Retain);
1828 AsciiSPrint (Value,
sizeof (Value),
"%d", Session->MaxOutstandingR2T);
1851 PadLen = ISCSI_GET_PAD_LEN (Len);
1856 return EFI_OUT_OF_RESOURCES;
1885 if (ListHead ==
NULL) {
1893 if (KeyValuePair ==
NULL) {
1899 KeyValuePair->Key = Data;
1901 while ((Len > 0) && (*Data !=
'=')) {
1916 KeyValuePair->Value = Data;
1921 Len -= (UINT32)
AsciiStrLen (KeyValuePair->Value) + 1;
1956 NET_LIST_FOR_EACH (Entry, KeyValueList) {
1960 Value = KeyValuePair->Value;
2013 for (Index = 0; Index < Len; Index++) {
2014 if (NET_IS_UPPER_CASE_CHAR (Name[Index])) {
2018 Name[Index] = (CHAR8)(Name[Index] -
'A' +
'a');
2021 if (!NET_IS_LOWER_CASE_CHAR (Name[Index]) &&
2022 !NET_IS_DIGIT (Name[Index]) &&
2023 (Name[Index] !=
'-') &&
2024 (Name[Index] !=
'.') &&
2025 (Name[Index] !=
':')
2032 return EFI_PROTOCOL_ERROR;
2036 if ((Len < 4) || (
CompareMem (Name,
"iqn.", 4) != 0)) {
2040 return EFI_PROTOCOL_ERROR;
2066 ASSERT (Tcb !=
NULL);
2068 Session = Conn->Session;
2070 if (ISCSI_SEQ_GT (Session->CmdSN, Session->MaxCmdSN)) {
2071 return EFI_NOT_READY;
2075 if (NewTcb ==
NULL) {
2076 return EFI_OUT_OF_RESOURCES;
2081 NewTcb->SoFarInOrder =
TRUE;
2082 NewTcb->InitiatorTaskTag = Session->InitiatorTaskTag;
2083 NewTcb->CmdSN = Session->CmdSN;
2084 NewTcb->Conn = Conn;
2091 Session->InitiatorTaskTag++;
2129 IN BOOLEAN DataDigest
2133 UINT32 FragmentCount;
2137 Fragment[0].Len = Len;
2138 Fragment[0].Bulk = Data;
2140 PadLen = ISCSI_GET_PAD_LEN (Len);
2142 Fragment[1].Len = PadLen;
2143 Fragment[1].Bulk = (UINT8 *)&mDataSegPad;
2184 UINT32 ImmediateDataLen;
2188 if (Packet->DataDirection == DataBi) {
2196 if (Packet->CdbLength > 16) {
2205 if (PduHeader ==
NULL) {
2210 if (ScsiCmd ==
NULL) {
2219 ISCSI_SET_OPCODE (ScsiCmd, ISCSI_OPCODE_SCSI_CMD, 0);
2220 ISCSI_SET_FLAG (ScsiCmd, ISCSI_TASK_ATTR_SIMPLE);
2225 switch (Packet->DataDirection) {
2227 ISCSI_SET_FLAG (ScsiCmd, SCSI_CMD_PDU_FLAG_READ);
2228 ScsiCmd->ExpDataXferLength = NTOHL (Packet->InTransferLength);
2232 ISCSI_SET_FLAG (ScsiCmd, SCSI_CMD_PDU_FLAG_WRITE);
2233 ScsiCmd->ExpDataXferLength = NTOHL (Packet->OutTransferLength);
2237 ISCSI_SET_FLAG (ScsiCmd, SCSI_CMD_PDU_FLAG_READ | SCSI_CMD_PDU_FLAG_WRITE);
2238 ScsiCmd->ExpDataXferLength = NTOHL (Packet->OutTransferLength);
2246 BiExpReadDataLenAHS->Length = NTOHS (5);
2247 BiExpReadDataLenAHS->Type = ISCSI_AHS_TYPE_BI_EXP_READ_DATA_LEN;
2248 BiExpReadDataLenAHS->ExpReadDataLength = NTOHL (Packet->InTransferLength);
2253 ScsiCmd->TotalAHSLength = AHSLength;
2254 CopyMem (ScsiCmd->Lun, &Lun, sizeof (ScsiCmd->Lun));
2255 ScsiCmd->InitiatorTaskTag = NTOHL (Tcb->InitiatorTaskTag);
2256 ScsiCmd->CmdSN = NTOHL (Tcb->CmdSN);
2257 ScsiCmd->ExpStatSN = NTOHL (Tcb->Conn->ExpStatSN);
2259 CopyMem (ScsiCmd->Cdb, Packet->Cdb, sizeof (ScsiCmd->Cdb));
2261 if (Packet->CdbLength > 16) {
2262 Header->Length = NTOHS ((UINT16)(Packet->CdbLength - 15));
2263 Header->Type = ISCSI_AHS_TYPE_EXT_CDB;
2265 CopyMem (Header + 1, (UINT8 *)Packet->Cdb + 16, Packet->CdbLength - 16);
2269 Session = Tcb->Conn->Session;
2270 ImmediateDataLen = 0;
2272 if (Session->ImmediateData && (Packet->OutTransferLength != 0)) {
2278 ImmediateDataLen =
MIN (Session->FirstBurstLength, Packet->OutTransferLength);
2279 ImmediateDataLen =
MIN (ImmediateDataLen, Tcb->Conn->MaxRecvDataSegmentLength);
2284 ISCSI_SET_DATASEG_LEN (ScsiCmd, ImmediateDataLen);
2290 if (DataSeg ==
NULL) {
2297 if (NbufList ==
NULL) {
2315 if (Session->InitialR2T ||
2316 (ImmediateDataLen == Session->FirstBurstLength) ||
2317 (ImmediateDataLen == Packet->OutTransferLength)
2327 ISCSI_SET_FLAG (ScsiCmd, ISCSI_BHS_FLAG_FINAL);
2365 if (NbufList ==
NULL) {
2375 if (PduHdr ==
NULL) {
2386 if (DataOutHdr ==
NULL) {
2391 XferContext = &Tcb->XferContext;
2398 ISCSI_SET_OPCODE (DataOutHdr, ISCSI_OPCODE_SCSI_DATA_OUT, 0);
2399 ISCSI_SET_DATASEG_LEN (DataOutHdr, Len);
2401 DataOutHdr->InitiatorTaskTag = HTONL (Tcb->InitiatorTaskTag);
2402 DataOutHdr->TargetTransferTag = HTONL (XferContext->TargetTransferTag);
2403 DataOutHdr->ExpStatSN = HTONL (Tcb->Conn->ExpStatSN);
2404 DataOutHdr->DataSN = HTONL (DataSN);
2405 DataOutHdr->BufferOffset = HTONL (XferContext->Offset);
2407 if (XferContext->TargetTransferTag != ISCSI_RESERVED_TAG) {
2408 CopyMem (&DataOutHdr->Lun, &Lun, sizeof (DataOutHdr->Lun));
2415 if (DataSeg ==
NULL) {
2457 UINT8 *DataOutPacket;
2460 if (PduList ==
NULL) {
2469 XferContext = &Tcb->XferContext;
2471 while (XferContext->DesiredLength > 0) {
2475 DataLen =
MIN (XferContext->DesiredLength, Conn->MaxRecvDataSegmentLength);
2481 if (DataOutPdu ==
NULL) {
2494 XferContext->Offset += DataLen;
2495 XferContext->DesiredLength -= DataLen;
2503 if (DataOutPacket ==
NULL) {
2509 ISCSI_SET_FLAG (DataOutPacket, ISCSI_BHS_FLAG_FINAL);
2544 if (DataOutPduList ==
NULL) {
2545 return EFI_OUT_OF_RESOURCES;
2553 NET_LIST_FOR_EACH (Entry, DataOutPduList) {
2554 Pdu = NET_LIST_USER_STRUCT (Entry,
NET_BUF, List);
2558 if (EFI_ERROR (Status)) {
2593 if (DataInHdr ==
NULL) {
2594 return EFI_PROTOCOL_ERROR;
2597 DataInHdr->InitiatorTaskTag = NTOHL (DataInHdr->InitiatorTaskTag);
2598 DataInHdr->ExpCmdSN = NTOHL (DataInHdr->ExpCmdSN);
2599 DataInHdr->MaxCmdSN = NTOHL (DataInHdr->MaxCmdSN);
2600 DataInHdr->DataSN = NTOHL (DataInHdr->DataSN);
2605 Status =
IScsiCheckSN (&Tcb->ExpDataSN, DataInHdr->DataSN);
2606 if (EFI_ERROR (Status)) {
2610 if (DataInHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {
2611 return EFI_PROTOCOL_ERROR;
2617 IScsiUpdateCmdSN (Tcb->Conn->Session, DataInHdr->MaxCmdSN, DataInHdr->ExpCmdSN);
2619 if (ISCSI_FLAG_ON (DataInHdr, SCSI_DATA_IN_PDU_FLAG_STATUS_VALID)) {
2620 if (!ISCSI_FLAG_ON (DataInHdr, ISCSI_BHS_FLAG_FINAL)) {
2624 return EFI_PROTOCOL_ERROR;
2627 Tcb->StatusXferd =
TRUE;
2629 if (ISCSI_FLAG_ON (DataInHdr, SCSI_DATA_IN_PDU_FLAG_OVERFLOW | SCSI_DATA_IN_PDU_FLAG_UNDERFLOW)) {
2633 return EFI_PROTOCOL_ERROR;
2639 Status =
IScsiCheckSN (&Tcb->Conn->ExpStatSN, NTOHL (DataInHdr->StatSN));
2640 if (EFI_ERROR (Status)) {
2644 Packet->HostAdapterStatus = 0;
2645 Packet->TargetStatus = DataInHdr->Status;
2647 if (ISCSI_FLAG_ON (DataInHdr, SCSI_RSP_PDU_FLAG_OVERFLOW)) {
2648 Packet->InTransferLength += NTOHL (DataInHdr->ResidualCount);
2649 Status = EFI_BAD_BUFFER_SIZE;
2652 if (ISCSI_FLAG_ON (DataInHdr, SCSI_RSP_PDU_FLAG_UNDERFLOW)) {
2653 Packet->InTransferLength -= NTOHL (DataInHdr->ResidualCount);
2687 if (R2THdr ==
NULL) {
2688 return EFI_PROTOCOL_ERROR;
2691 R2THdr->InitiatorTaskTag = NTOHL (R2THdr->InitiatorTaskTag);
2692 R2THdr->TargetTransferTag = NTOHL (R2THdr->TargetTransferTag);
2693 R2THdr->StatSN = NTOHL (R2THdr->StatSN);
2694 R2THdr->R2TSeqNum = NTOHL (R2THdr->R2TSeqNum);
2695 R2THdr->BufferOffset = NTOHL (R2THdr->BufferOffset);
2696 R2THdr->DesiredDataTransferLength = NTOHL (R2THdr->DesiredDataTransferLength);
2698 if ((R2THdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) || !ISCSI_SEQ_EQ (R2THdr->StatSN, Tcb->Conn->ExpStatSN)) {
2699 return EFI_PROTOCOL_ERROR;
2705 Status =
IScsiCheckSN (&Tcb->ExpDataSN, R2THdr->R2TSeqNum);
2706 if (EFI_ERROR (Status)) {
2710 XferContext = &Tcb->XferContext;
2711 XferContext->TargetTransferTag = R2THdr->TargetTransferTag;
2712 XferContext->Offset = R2THdr->BufferOffset;
2713 XferContext->DesiredLength = R2THdr->DesiredDataTransferLength;
2715 if (((XferContext->Offset + XferContext->DesiredLength) > Packet->OutTransferLength) ||
2716 (XferContext->DesiredLength > Tcb->Conn->Session->MaxBurstLength)
2719 return EFI_PROTOCOL_ERROR;
2725 Data = (UINT8 *)Packet->OutDataBuffer + XferContext->Offset;
2757 if (ScsiRspHdr ==
NULL) {
2758 return EFI_PROTOCOL_ERROR;
2761 ScsiRspHdr->InitiatorTaskTag = NTOHL (ScsiRspHdr->InitiatorTaskTag);
2762 if (ScsiRspHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {
2763 return EFI_PROTOCOL_ERROR;
2766 ScsiRspHdr->StatSN = NTOHL (ScsiRspHdr->StatSN);
2768 Status =
IScsiCheckSN (&Tcb->Conn->ExpStatSN, ScsiRspHdr->StatSN);
2769 if (EFI_ERROR (Status)) {
2773 ScsiRspHdr->MaxCmdSN = NTOHL (ScsiRspHdr->MaxCmdSN);
2774 ScsiRspHdr->ExpCmdSN = NTOHL (ScsiRspHdr->ExpCmdSN);
2775 IScsiUpdateCmdSN (Tcb->Conn->Session, ScsiRspHdr->MaxCmdSN, ScsiRspHdr->ExpCmdSN);
2777 Tcb->StatusXferd =
TRUE;
2779 Packet->HostAdapterStatus = ScsiRspHdr->Response;
2780 if (Packet->HostAdapterStatus != ISCSI_SERVICE_RSP_COMMAND_COMPLETE_AT_TARGET) {
2784 Packet->TargetStatus = ScsiRspHdr->Status;
2786 if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW | SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW) ||
2787 ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_OVERFLOW | SCSI_RSP_PDU_FLAG_UNDERFLOW)
2790 return EFI_PROTOCOL_ERROR;
2793 if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW)) {
2794 Packet->InTransferLength += NTOHL (ScsiRspHdr->BiReadResidualCount);
2795 Status = EFI_BAD_BUFFER_SIZE;
2798 if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW)) {
2799 Packet->InTransferLength -= NTOHL (ScsiRspHdr->BiReadResidualCount);
2802 if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_OVERFLOW)) {
2803 if (Packet->DataDirection == DataIn) {
2804 Packet->InTransferLength += NTOHL (ScsiRspHdr->ResidualCount);
2806 Packet->OutTransferLength += NTOHL (ScsiRspHdr->ResidualCount);
2809 Status = EFI_BAD_BUFFER_SIZE;
2812 if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_UNDERFLOW)) {
2813 if (Packet->DataDirection == DataIn) {
2814 Packet->InTransferLength -= NTOHL (ScsiRspHdr->ResidualCount);
2816 Packet->OutTransferLength -= NTOHL (ScsiRspHdr->ResidualCount);
2820 DataSegLen = ISCSI_GET_DATASEG_LEN (ScsiRspHdr);
2821 if (DataSegLen != 0) {
2823 if (SenseData ==
NULL) {
2824 return EFI_PROTOCOL_ERROR;
2827 SenseData->Length = NTOHS (SenseData->Length);
2829 Packet->SenseDataLength = (UINT8)
MIN (SenseData->Length, Packet->SenseDataLength);
2830 if (Packet->SenseDataLength != 0) {
2831 CopyMem (Packet->SenseData, &SenseData->Data[0], Packet->SenseDataLength);
2834 Packet->SenseDataLength = 0;
2861 if (NopInHdr ==
NULL) {
2862 return EFI_PROTOCOL_ERROR;
2865 NopInHdr->StatSN = NTOHL (NopInHdr->StatSN);
2866 NopInHdr->ExpCmdSN = NTOHL (NopInHdr->ExpCmdSN);
2867 NopInHdr->MaxCmdSN = NTOHL (NopInHdr->MaxCmdSN);
2869 if (NopInHdr->InitiatorTaskTag == ISCSI_RESERVED_TAG) {
2870 if (NopInHdr->StatSN != Tcb->Conn->ExpStatSN) {
2871 return EFI_PROTOCOL_ERROR;
2874 Status =
IScsiCheckSN (&Tcb->Conn->ExpStatSN, NopInHdr->StatSN);
2875 if (EFI_ERROR (Status)) {
2880 IScsiUpdateCmdSN (Tcb->Conn->Session, NopInHdr->MaxCmdSN, NopInHdr->ExpCmdSN);
2924 Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (PassThru);
2925 Session = Private->Session;
2928 TimeoutEvent =
NULL;
2931 if (Session->State != SESSION_STATE_LOGGED_IN) {
2932 Status = EFI_DEVICE_ERROR;
2936 Conn = NET_LIST_USER_STRUCT_S (
2937 Session->Conns.ForwardLink,
2940 ISCSI_CONNECTION_SIGNATURE
2943 if (Packet->Timeout != 0) {
2948 if (EFI_ERROR (Status)) {
2957 Status = EFI_OUT_OF_RESOURCES;
2961 XferContext = &Tcb->XferContext;
2963 if (PduHdr ==
NULL) {
2964 Status = EFI_PROTOCOL_ERROR;
2969 XferContext->Offset = ISCSI_GET_DATASEG_LEN (PduHdr);
2978 if (EFI_ERROR (Status)) {
2982 if (!Session->InitialR2T &&
2983 (XferContext->Offset < Session->FirstBurstLength) &&
2984 (XferContext->Offset < Packet->OutTransferLength)
2991 XferContext->TargetTransferTag = ISCSI_RESERVED_TAG;
2992 XferContext->DesiredLength =
MIN (
2993 Session->FirstBurstLength,
2994 Packet->OutTransferLength - XferContext->Offset
2997 Data = (UINT8 *)Packet->OutDataBuffer + XferContext->Offset;
2999 if (EFI_ERROR (Status)) {
3004 InBufferContext.InData = (UINT8 *)Packet->InDataBuffer;
3005 InBufferContext.InDataLen = Packet->InTransferLength;
3007 while (!Tcb->StatusXferd) {
3013 if (EFI_ERROR (Status)) {
3017 TimeoutEvent = Conn->TimeoutEvent;
3024 if (EFI_ERROR (Status)) {
3029 if (PduHdr ==
NULL) {
3030 Status = EFI_PROTOCOL_ERROR;
3035 switch (ISCSI_GET_OPCODE (PduHdr)) {
3036 case ISCSI_OPCODE_SCSI_DATA_IN:
3040 case ISCSI_OPCODE_R2T:
3044 case ISCSI_OPCODE_SCSI_RSP:
3048 case ISCSI_OPCODE_NOP_IN:
3052 case ISCSI_OPCODE_VENDOR_T0:
3053 case ISCSI_OPCODE_VENDOR_T1:
3054 case ISCSI_OPCODE_VENDOR_T2:
3061 Status = EFI_PROTOCOL_ERROR;
3067 if (EFI_ERROR (Status)) {
3074 if (TimeoutEvent !=
NULL) {
3131 Session->Signature = ISCSI_SESSION_SIGNATURE;
3141 Session->InitiatorTaskTag = 1;
3142 Session->NextCid = 1;
3144 Session->TargetPortalGroupTag = 0;
3145 Session->MaxConnections = ISCSI_MAX_CONNS_PER_SESSION;
3146 Session->InitialR2T =
FALSE;
3147 Session->ImmediateData =
TRUE;
3148 Session->MaxBurstLength = 262144;
3149 Session->FirstBurstLength = MAX_RECV_DATA_SEG_LEN_IN_FFP;
3150 Session->DefaultTime2Wait = 2;
3151 Session->DefaultTime2Retain = 20;
3152 Session->MaxOutstandingR2T = DEFAULT_MAX_OUTSTANDING_R2T;
3153 Session->DataPDUInOrder =
TRUE;
3154 Session->DataSequenceInOrder =
TRUE;
3155 Session->ErrorRecoveryLevel = 0;
3173 if (Session->State != SESSION_STATE_LOGGED_IN) {
3180 Conn = NET_LIST_USER_STRUCT_S (
3181 Session->Conns.ForwardLink,
3184 ISCSI_CONNECTION_SIGNATURE
3186 if (!Conn->Ipv6Flag) {
3187 ProtocolGuid = &gEfiTcp4ProtocolGuid;
3189 ProtocolGuid = &gEfiTcp6ProtocolGuid;
3192 gBS->CloseProtocol (
3195 Session->Private->Image,
3196 Session->Private->ExtScsiPassThruHandle
3205 Session->State = SESSION_STATE_FAILED;
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
UINTN EFIAPI AsciiStrDecimalToUintn(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS IScsiCHAPToSendReq(IN ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
EFI_STATUS IScsiCHAPOnRspReceived(IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiDns4(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData)
EFI_STATUS IScsiDns6(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData)
#define ISCSI_WAIT_IPSEC_TIMEOUT
UINTN IScsiNetNtoi(IN CHAR8 *Str)
EFI_STATUS IScsiAsciiStrToIp(IN CHAR8 *Str, IN UINT8 IpMode, OUT EFI_IP_ADDRESS *Ip)
EFI_STATUS IScsiSessionReinstatement(IN ISCSI_SESSION *Session)
VOID IScsiDelTcb(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 IScsiCheckSN(IN OUT UINT32 *ExpSN, IN UINT32 NewSN)
EFI_STATUS IScsiSendLoginReq(IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiReceiveLoginRsp(IN ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiNewTcb(IN ISCSI_CONNECTION *Conn, OUT ISCSI_TCB **Tcb)
VOID EFIAPI IScsiFreeNbufList(VOID *Arg)
VOID IScsiAttatchConnection(IN OUT ISCSI_SESSION *Session, IN OUT ISCSI_CONNECTION *Conn)
STATIC VOID IScsiSessionResetAuthData(IN OUT ISCSI_SESSION *Session)
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)
VOID IScsiUpdateCmdSN(IN OUT ISCSI_SESSION *Session, IN UINT32 MaxCmdSN, IN UINT32 ExpCmdSN)
VOID IScsiSessionAbort(IN OUT ISCSI_SESSION *Session)
NET_BUF * IScsiPrepareLoginReq(IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiProcessLoginRsp(IN OUT ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
EFI_STATUS IScsiOnNopInRcvd(IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb)
VOID IScsiFillOpParams(IN ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
NET_BUF * IScsiNewDataOutPdu(IN UINT8 *Data, IN UINT32 Len, IN UINT32 DataSN, IN ISCSI_TCB *Tcb, IN UINT64 Lun)
EFI_STATUS IScsiGetIp6NicInfo(IN ISCSI_CONNECTION *Conn)
VOID IScsiDestroyConnection(IN ISCSI_CONNECTION *Conn)
VOID IScsiFreeKeyValueList(IN LIST_ENTRY *KeyValueList)
NET_BUF * IScsiNewScsiCmdPdu(IN EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, IN UINT64 Lun, IN ISCSI_TCB *Tcb)
CHAR8 * IScsiGetValueByKeyFromList(IN OUT LIST_ENTRY *KeyValueList, IN CHAR8 *Key)
EFI_STATUS IScsiUpdateTargetAddress(IN OUT ISCSI_SESSION *Session, IN CHAR8 *Data, IN UINT32 Len)
EFI_STATUS IScsiSendDataOutPduSequence(IN UINT8 *Data, IN UINT64 Lun, IN ISCSI_TCB *Tcb)
EFI_STATUS IScsiPadSegment(IN OUT NET_BUF *Pdu, IN UINT32 Len)
VOID IScsiDetatchConnection(IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiCheckOpParams(IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiConnLogin(IN OUT ISCSI_CONNECTION *Conn, IN UINT16 Timeout)
EFI_STATUS IScsiSessionLogin(IN ISCSI_SESSION *Session)
EFI_STATUS IScsiNormalizeName(IN OUT CHAR8 *Name, IN UINTN Len)
LIST_ENTRY * IScsiBuildKeyValueList(IN CHAR8 *Data, IN UINT32 Len)
VOID EFIAPI IScsiNbufExtFree(VOID *Arg)
LIST_ENTRY * IScsiGenerateDataOutPduSequence(IN UINT8 *Data, IN ISCSI_TCB *Tcb, IN UINT64 Lun)
EFI_STATUS IScsiAddKeyValuePair(IN OUT NET_BUF *Pdu, IN CHAR8 *Key, IN CHAR8 *Value)
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 IScsiSessionReLogin(IN ISCSI_SESSION *Session)
ISCSI_CONNECTION * IScsiCreateConnection(IN ISCSI_SESSION *Session)
VOID IScsiSessionInit(IN OUT ISCSI_SESSION *Session, IN BOOLEAN Recovery)
NET_BUF * IScsiNewDataSegment(IN UINT8 *Data, IN UINT32 Len, IN BOOLEAN DataDigest)
VOID IScsiConnReset(IN OUT ISCSI_CONNECTION *Conn)
EFI_STATUS IScsiReceivePdu(IN ISCSI_CONNECTION *Conn, OUT NET_BUF **Pdu, IN ISCSI_IN_BUFFER_CONTEXT *Context OPTIONAL, IN BOOLEAN HeaderDigest, IN BOOLEAN DataDigest, IN EFI_EVENT TimeoutEvent OPTIONAL)
EFI_STATUS IScsiOnScsiRspRcvd(IN NET_BUF *Pdu, IN ISCSI_TCB *Tcb, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
#define SESSION_STATE_FREE
struct _ISCSI_BASIC_HEADER ISCSI_BASIC_HEADER
struct _SCSI_COMMAND SCSI_COMMAND
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
VOID EFIAPI NetbufQueInit(IN OUT NET_BUF_QUEUE *NbufQue)
LIST_ENTRY *EFIAPI NetListRemoveHead(IN OUT LIST_ENTRY *Head)
UINT32 EFIAPI NetbufTrim(IN OUT NET_BUF *Nbuf, IN UINT32 Len, IN BOOLEAN FromHead)
UINT32 EFIAPI NetbufQueCopy(IN NET_BUF_QUEUE *NbufQue, IN UINT32 Offset, IN UINT32 Len, OUT UINT8 *Dest)
VOID EFIAPI NetbufQueFlush(IN OUT NET_BUF_QUEUE *NbufQue)
BOOLEAN EFIAPI NetIp6IsNetEqual(EFI_IPv6_ADDRESS *Ip1, EFI_IPv6_ADDRESS *Ip2, UINT8 PrefixLength)
NET_BUF *EFIAPI NetbufAlloc(IN UINT32 Len)
NET_BUF *EFIAPI NetbufFromExt(IN NET_FRAGMENT *ExtFragment, IN UINT32 ExtNum, IN UINT32 HeadSpace, IN UINT32 HeadLen, IN NET_VECTOR_EXT_FREE ExtFree, IN VOID *Arg OPTIONAL)
NET_BUF *EFIAPI NetbufFromBufList(IN LIST_ENTRY *BufList, IN UINT32 HeadSpace, IN UINT32 HeaderLen, IN NET_VECTOR_EXT_FREE ExtFree, IN VOID *Arg OPTIONAL)
EFI_STATUS EFIAPI NetLibDetectMediaWaitTimeout(IN EFI_HANDLE ServiceHandle, IN UINT64 Timeout, OUT EFI_STATUS *MediaState)
UINT8 *EFIAPI NetbufAllocSpace(IN OUT NET_BUF *Nbuf, IN UINT32 Len, IN BOOLEAN FromHead)
VOID EFIAPI NetbufFreeList(IN OUT LIST_ENTRY *Head)
UINT8 *EFIAPI NetbufGetByte(IN NET_BUF *Nbuf, IN UINT32 Offset, OUT UINT32 *Index OPTIONAL)
VOID EFIAPI NetbufQueAppend(IN OUT NET_BUF_QUEUE *NbufQue, IN OUT NET_BUF *Nbuf)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI TcpIoCreateSocket(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN UINT8 TcpVersion, IN TCP_IO_CONFIG_DATA *ConfigData, OUT TCP_IO *TcpIo)
EFI_STATUS EFIAPI TcpIoReceive(IN OUT TCP_IO *TcpIo, IN NET_BUF *Packet, IN BOOLEAN AsyncMode, IN EFI_EVENT Timeout OPTIONAL)
EFI_STATUS EFIAPI TcpIoConnect(IN OUT TCP_IO *TcpIo, IN EFI_EVENT Timeout OPTIONAL)
EFI_STATUS EFIAPI TcpIoTransmit(IN TCP_IO *TcpIo, IN NET_BUF *Packet)
VOID EFIAPI TcpIoDestroySocket(IN TCP_IO *TcpIo)
VOID EFIAPI TcpIoReset(IN OUT TCP_IO *TcpIo)
UINT8 PrefixLength
The length of the prefix associated with the Address.
EFI_IPv6_ADDRESS Address
The IPv6 address.
EFI_IPv6_ADDRESS StationAddress
EFI_IP6_NEIGHBOR_CACHE * NeighborCache
EFI_IP6_ICMP_TYPE * IcmpTypeList
EFI_IP6_ADDRESS_INFO * AddressList
EFI_IP6_ROUTE_TABLE * RouteTable
EFI_IPv6_ADDRESS * GroupTable
EFI_IP6_CONFIG_DATA ConfigData
EFI_IP6_ADDRESS_INFO * PrefixTable
EFI_IPv6_ADDRESS Destination