2 Mtftp6 Rrq process functions implementation.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "Mtftp6Impl.h"
20 Build and send a ACK packet for download.
22 @param[in] Instance The pointer to the Mtftp6 instance.
23 @param[in] BlockNum The block number to be acked.
25 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the packet.
26 @retval EFI_SUCCESS The ACK has been sent.
27 @retval Others Failed to send the ACK.
32 IN MTFTP6_INSTANCE
*Instance
,
36 EFI_MTFTP6_PACKET
*Ack
;
43 // Allocate net buffer to create ack packet.
45 Packet
= NetbufAlloc (sizeof (EFI_MTFTP6_ACK_HEADER
));
48 return EFI_OUT_OF_RESOURCES
;
51 Ack
= (EFI_MTFTP6_PACKET
*) NetbufAllocSpace (
53 sizeof (EFI_MTFTP6_ACK_HEADER
),
58 Ack
->Ack
.OpCode
= HTONS (EFI_MTFTP6_OPCODE_ACK
);
59 Ack
->Ack
.Block
[0] = HTONS (BlockNum
);
62 // Reset current retry count of the instance.
64 Instance
->CurRetry
= 0;
65 Instance
->LastPacket
= Packet
;
67 Status
= Mtftp6TransmitPacket (Instance
, Packet
);
68 if (!EFI_ERROR (Status
)) {
69 Instance
->AckedBlock
= Instance
->TotalBlock
;
77 Deliver the received data block to the user, which can be saved
78 in the user provide buffer or through the CheckPacket callback.
80 @param[in] Instance The pointer to the Mtftp6 instance.
81 @param[in] Packet The pointer to the received packet.
82 @param[in] Len The packet length.
83 @param[out] UdpPacket The net buf of the received packet.
85 @retval EFI_SUCCESS The data was saved successfully.
86 @retval EFI_ABORTED The user tells to abort by return an error through
88 @retval EFI_BUFFER_TOO_SMALL The user's buffer is too small, and buffer length is
89 updated to the actual buffer size needed.
94 IN MTFTP6_INSTANCE
*Instance
,
95 IN EFI_MTFTP6_PACKET
*Packet
,
97 OUT NET_BUF
**UdpPacket
100 EFI_MTFTP6_TOKEN
*Token
;
109 Token
= Instance
->Token
;
110 Block
= NTOHS (Packet
->Data
.Block
);
111 DataLen
= Len
- MTFTP6_DATA_HEAD_LEN
;
114 // This is the last block, save the block num
116 if (DataLen
< Instance
->BlkSize
) {
118 Instance
->LastBlk
= Block
;
119 Mtftp6SetLastBlockNum (&Instance
->BlkList
, Block
);
123 // Remove this block number from the file hole. If Mtftp6RemoveBlockNum
124 // returns EFI_NOT_FOUND, the block has been saved, don't save it again.
125 // Note that : For bigger files, allowing the block counter to roll over
126 // to accept transfers of unlimited size. So BlockCounter is memorised as
127 // continuous block counter.
129 Status
= Mtftp6RemoveBlockNum (&Instance
->BlkList
, Block
, Completed
, &BlockCounter
);
131 if (Status
== EFI_NOT_FOUND
) {
133 } else if (EFI_ERROR (Status
)) {
137 if (Token
->CheckPacket
!= NULL
) {
139 // Callback to the check packet routine with the received packet.
141 Status
= Token
->CheckPacket (&Instance
->Mtftp6
, Token
, (UINT16
) Len
, Packet
);
143 if (EFI_ERROR (Status
)) {
145 // Free the received packet before send new packet in ReceiveNotify,
146 // since the Udp6Io might need to be reconfigured.
148 NetbufFree (*UdpPacket
);
151 // Send the Mtftp6 error message if user aborted the current session.
155 EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION
,
156 (UINT8
*) "User aborted download"
163 if (Token
->Buffer
!= NULL
) {
165 Start
= MultU64x32 (BlockCounter
- 1, Instance
->BlkSize
);
166 if (Start
+ DataLen
<= Token
->BufferSize
) {
167 CopyMem ((UINT8
*) Token
->Buffer
+ Start
, Packet
->Data
.Data
, DataLen
);
169 // Update the file size when received the last block
171 if ((Instance
->LastBlk
== Block
) && Completed
) {
172 Token
->BufferSize
= Start
+ DataLen
;
174 } else if (Instance
->LastBlk
!= 0) {
176 // Don't save the data if the buffer is too small, return
177 // EFI_BUFFER_TOO_SMALL if received the last packet. This
178 // will give a accurate file length.
180 Token
->BufferSize
= Start
+ DataLen
;
183 // Free the received packet before send new packet in ReceiveNotify,
184 // since the udpio might need to be reconfigured.
186 NetbufFree (*UdpPacket
);
189 // Send the Mtftp6 error message if no enough buffer.
193 EFI_MTFTP6_ERRORCODE_DISK_FULL
,
194 (UINT8
*) "User provided memory block is too small"
197 return EFI_BUFFER_TOO_SMALL
;
206 Process the received data packets. It will save the block
207 then send back an ACK if it is active.
209 @param[in] Instance The pointer to the Mtftp6 instance.
210 @param[in] Packet The pointer to the received packet.
211 @param[in] Len The length of the packet.
212 @param[out] UdpPacket The net buf of received packet.
213 @param[out] IsCompleted If TRUE, the download has been completed.
214 Otherwise, the download has not been completed.
216 @retval EFI_SUCCESS The data packet was successfully processed.
217 @retval EFI_ABORTED The download was aborted by the user.
218 @retval EFI_BUFFER_TOO_SMALL The user-provided buffer is too small.
222 Mtftp6RrqHandleData (
223 IN MTFTP6_INSTANCE
*Instance
,
224 IN EFI_MTFTP6_PACKET
*Packet
,
226 OUT NET_BUF
**UdpPacket
,
227 OUT BOOLEAN
*IsCompleted
234 *IsCompleted
= FALSE
;
235 Status
= EFI_SUCCESS
;
236 BlockNum
= NTOHS (Packet
->Data
.Block
);
237 Expected
= Mtftp6GetNextBlockNum (&Instance
->BlkList
);
239 ASSERT (Expected
>= 0);
242 // If we are active (Master) and received an unexpected packet, transmit
243 // the ACK for the block we received, then restart receiving the
244 // expected one. If we are passive (Slave), save the block.
246 if (Instance
->IsMaster
&& (Expected
!= BlockNum
)) {
248 // Free the received packet before send new packet in ReceiveNotify,
249 // since the udpio might need to be reconfigured.
251 NetbufFree (*UdpPacket
);
255 // If Expected is 0, (UINT16) (Expected - 1) is also the expected Ack number (65535).
257 return Mtftp6RrqSendAck (Instance
, (UINT16
) (Expected
- 1));
260 Status
= Mtftp6RrqSaveBlock (Instance
, Packet
, Len
, UdpPacket
);
262 if (EFI_ERROR (Status
)) {
267 // Record the total received and saved block number.
269 Instance
->TotalBlock
++;
272 // Reset the passive client's timer whenever it received a valid data packet.
274 if (!Instance
->IsMaster
) {
275 Instance
->PacketToLive
= Instance
->Timeout
* 2;
279 // Check whether we have received all the blocks. Send the ACK if we
280 // are active (unicast client or master client for multicast download).
281 // If we have received all the blocks, send an ACK even if we are passive
282 // to tell the server that we are done.
284 Expected
= Mtftp6GetNextBlockNum (&Instance
->BlkList
);
286 if (Instance
->IsMaster
|| Expected
< 0) {
289 // If we are passive client, then the just received Block maybe
290 // isn't the last block. We need to send an ACK to the last block
291 // to inform the server that we are done. If we are active client,
292 // the Block == Instance->LastBlock.
294 BlockNum
= Instance
->LastBlk
;
298 BlockNum
= (UINT16
) (Expected
- 1);
301 // Free the received packet before send new packet in ReceiveNotify,
302 // since the udpio might need to be reconfigured.
304 NetbufFree (*UdpPacket
);
307 if (Instance
->WindowSize
== (Instance
->TotalBlock
- Instance
->AckedBlock
) || Expected
< 0) {
308 Status
= Mtftp6RrqSendAck (Instance
, BlockNum
);
317 Validate whether the options received in the server's OACK packet is valid.
318 The options are valid only if:
319 1. The server doesn't include options not requested by us.
320 2. The server can only use smaller blksize than that is requested.
321 3. The server can only use the same timeout as requested.
322 4. The server doesn't change its multicast channel.
324 @param[in] Instance The pointer to the Mtftp6 instance.
325 @param[in] ReplyInfo The pointer to options information in reply packet.
326 @param[in] RequestInfo The pointer to requested options info.
328 @retval TRUE If the option in the OACK is valid.
329 @retval FALSE If the option is invalid.
334 IN MTFTP6_INSTANCE
*Instance
,
335 IN MTFTP6_EXT_OPTION_INFO
*ReplyInfo
,
336 IN MTFTP6_EXT_OPTION_INFO
*RequestInfo
340 // It is invalid for server to return options we don't request
342 if ((ReplyInfo
->BitMap
& ~RequestInfo
->BitMap
) != 0) {
347 // Server can only specify a smaller block size and windowsize to be used and
348 // return the timeout matches that requested.
350 if ((((ReplyInfo
->BitMap
& MTFTP6_OPT_BLKSIZE_BIT
) != 0) && (ReplyInfo
->BlkSize
> RequestInfo
->BlkSize
)) ||
351 (((ReplyInfo
->BitMap
& MTFTP6_OPT_WINDOWSIZE_BIT
) != 0) && (ReplyInfo
->BlkSize
> RequestInfo
->BlkSize
)) ||
352 (((ReplyInfo
->BitMap
& MTFTP6_OPT_TIMEOUT_BIT
) != 0) && (ReplyInfo
->Timeout
!= RequestInfo
->Timeout
))
358 // The server can send ",,master" to client to change its master
359 // setting. But if it use the specific multicast channel, it can't
360 // change the setting.
362 if (((ReplyInfo
->BitMap
& MTFTP6_OPT_MCAST_BIT
) != 0) && !NetIp6IsUnspecifiedAddr (&Instance
->McastIp
)) {
364 if (!NetIp6IsUnspecifiedAddr (&ReplyInfo
->McastIp
) && CompareMem (
367 sizeof (EFI_IPv6_ADDRESS
)
372 if ((ReplyInfo
->McastPort
!= 0) && (ReplyInfo
->McastPort
!= Instance
->McastPort
)) {
382 Configure Udp6Io to receive a packet from a multicast address.
384 @param[in] McastIo The pointer to the mcast Udp6Io.
385 @param[in] Context The pointer to the context.
387 @retval EFI_SUCCESS The mcast Udp6Io was successfully configured.
388 @retval Others Failed to configure the Udp6Io.
393 Mtftp6RrqConfigMcastUdpIo (
399 EFI_UDP6_PROTOCOL
*Udp6
;
400 EFI_UDP6_CONFIG_DATA
*Udp6Cfg
;
401 EFI_IPv6_ADDRESS Group
;
402 MTFTP6_INSTANCE
*Instance
;
404 Udp6
= McastIo
->Protocol
.Udp6
;
405 Udp6Cfg
= &(McastIo
->Config
.Udp6
);
406 Instance
= (MTFTP6_INSTANCE
*) Context
;
409 // Set the configure data for the mcast Udp6Io.
411 ZeroMem (Udp6Cfg
, sizeof (EFI_UDP6_CONFIG_DATA
));
413 Udp6Cfg
->AcceptPromiscuous
= FALSE
;
414 Udp6Cfg
->AcceptAnyPort
= FALSE
;
415 Udp6Cfg
->AllowDuplicatePort
= FALSE
;
416 Udp6Cfg
->TrafficClass
= 0;
417 Udp6Cfg
->HopLimit
= 128;
418 Udp6Cfg
->ReceiveTimeout
= 0;
419 Udp6Cfg
->TransmitTimeout
= 0;
420 Udp6Cfg
->StationPort
= Instance
->McastPort
;
421 Udp6Cfg
->RemotePort
= 0;
424 &Udp6Cfg
->RemoteAddress
,
426 sizeof (EFI_IPv6_ADDRESS
)
430 // Configure the mcast Udp6Io.
432 Status
= Udp6
->Configure (Udp6
, Udp6Cfg
);
434 if (EFI_ERROR (Status
)) {
439 // Join the multicast group
441 CopyMem (&Group
, &Instance
->McastIp
, sizeof (EFI_IPv6_ADDRESS
));
443 return Udp6
->Groups (Udp6
, TRUE
, &Group
);
448 Process the OACK packet for Rrq.
450 @param[in] Instance The pointer to the Mtftp6 instance.
451 @param[in] Packet The pointer to the received packet.
452 @param[in] Len The length of the packet.
453 @param[out] UdpPacket The net buf of received packet.
454 @param[out] IsCompleted If TRUE, the download has been completed.
455 Otherwise, the download has not been completed.
457 @retval EFI_DEVICE_ERROR Failed to create/start a multicast Udp6 child.
458 @retval EFI_TFTP_ERROR An error happened during the process.
459 @retval EFI_SUCCESS The OACK packet successfully processed.
463 Mtftp6RrqHandleOack (
464 IN MTFTP6_INSTANCE
*Instance
,
465 IN EFI_MTFTP6_PACKET
*Packet
,
467 OUT NET_BUF
**UdpPacket
,
468 OUT BOOLEAN
*IsCompleted
471 EFI_MTFTP6_OPTION
*Options
;
473 MTFTP6_EXT_OPTION_INFO ExtInfo
;
476 EFI_UDP6_PROTOCOL
*Udp6
;
478 *IsCompleted
= FALSE
;
482 // If already started the master download, don't change the
483 // setting. Master download always succeeds.
485 Expected
= Mtftp6GetNextBlockNum (&Instance
->BlkList
);
486 ASSERT (Expected
!= -1);
488 if (Instance
->IsMaster
&& Expected
!= 1) {
492 ZeroMem (&ExtInfo
, sizeof (MTFTP6_EXT_OPTION_INFO
));
495 // Parse the options in the packet.
497 Status
= Mtftp6ParseStart (Packet
, Len
, &Count
, &Options
);
499 if (EFI_ERROR (Status
)) {
502 ASSERT (Options
!= NULL
);
505 // Parse the extensive options in the packet.
507 Status
= Mtftp6ParseExtensionOption (Options
, Count
, FALSE
, Instance
->Operation
, &ExtInfo
);
509 if (EFI_ERROR (Status
) || !Mtftp6RrqOackValid (Instance
, &ExtInfo
, &Instance
->ExtInfo
)) {
511 // Don't send an ERROR packet if the error is EFI_OUT_OF_RESOURCES.
513 if (Status
!= EFI_OUT_OF_RESOURCES
) {
515 // Free the received packet before send new packet in ReceiveNotify,
516 // since the udpio might need to be reconfigured.
518 NetbufFree (*UdpPacket
);
521 // Send the Mtftp6 error message if invalid packet.
525 EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION
,
526 (UINT8
*) "Mal-formated OACK packet"
530 return EFI_TFTP_ERROR
;
533 if ((ExtInfo
.BitMap
& MTFTP6_OPT_MCAST_BIT
) != 0) {
536 // Save the multicast info. Always update the Master, only update the
537 // multicast IP address, block size, window size, timeoute at the first time. If IP
538 // address is updated, create a UDP child to receive the multicast.
540 Instance
->IsMaster
= ExtInfo
.IsMaster
;
542 if (NetIp6IsUnspecifiedAddr (&Instance
->McastIp
)) {
543 if (NetIp6IsUnspecifiedAddr (&ExtInfo
.McastIp
) || ExtInfo
.McastPort
== 0) {
545 // Free the received packet before send new packet in ReceiveNotify,
546 // since the udpio might need to be reconfigured.
548 NetbufFree (*UdpPacket
);
551 // Send the Mtftp6 error message if invalid multi-cast setting.
555 EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION
,
556 (UINT8
*) "Illegal multicast setting"
559 return EFI_TFTP_ERROR
;
563 // Create a UDP child then start receive the multicast from it.
568 sizeof (EFI_IP_ADDRESS
)
571 Instance
->McastPort
= ExtInfo
.McastPort
;
572 if (Instance
->McastUdpIo
== NULL
) {
573 Instance
->McastUdpIo
= UdpIoCreateIo (
574 Instance
->Service
->Controller
,
575 Instance
->Service
->Image
,
576 Mtftp6RrqConfigMcastUdpIo
,
580 if (Instance
->McastUdpIo
!= NULL
) {
581 Status
= gBS
->OpenProtocol (
582 Instance
->McastUdpIo
->UdpHandle
,
583 &gEfiUdp6ProtocolGuid
,
585 Instance
->Service
->Image
,
587 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
589 if (EFI_ERROR (Status
)) {
590 UdpIoFreeIo (Instance
->McastUdpIo
);
591 Instance
->McastUdpIo
= NULL
;
592 return EFI_DEVICE_ERROR
;
597 if (Instance
->McastUdpIo
== NULL
) {
598 return EFI_DEVICE_ERROR
;
601 Status
= UdpIoRecvDatagram (
602 Instance
->McastUdpIo
,
608 if (EFI_ERROR (Status
)) {
610 // Free the received packet before send new packet in ReceiveNotify,
611 // since the udpio might need to be reconfigured.
613 NetbufFree (*UdpPacket
);
616 // Send the Mtftp6 error message if failed to create Udp6Io to receive.
620 EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION
,
621 (UINT8
*) "Failed to create socket to receive multicast packet"
628 // Update the parameters used.
630 if (ExtInfo
.BlkSize
!= 0) {
631 Instance
->BlkSize
= ExtInfo
.BlkSize
;
634 if (ExtInfo
.WindowSize
!= 0) {
635 Instance
->WindowSize
= ExtInfo
.WindowSize
;
638 if (ExtInfo
.Timeout
!= 0) {
639 Instance
->Timeout
= ExtInfo
.Timeout
;
645 Instance
->IsMaster
= TRUE
;
647 if (ExtInfo
.BlkSize
!= 0) {
648 Instance
->BlkSize
= ExtInfo
.BlkSize
;
651 if (ExtInfo
.WindowSize
!= 0) {
652 Instance
->WindowSize
= ExtInfo
.WindowSize
;
655 if (ExtInfo
.Timeout
!= 0) {
656 Instance
->Timeout
= ExtInfo
.Timeout
;
661 // Free the received packet before send new packet in ReceiveNotify,
662 // since the udpio might need to be reconfigured.
664 NetbufFree (*UdpPacket
);
667 // Send an ACK to (Expected - 1) which is 0 for unicast download,
668 // or tell the server we want to receive the Expected block.
670 return Mtftp6RrqSendAck (Instance
, (UINT16
) (Expected
- 1));
675 The packet process callback for Mtftp6 download.
677 @param[in] UdpPacket The pointer to the packet received.
678 @param[in] UdpEpt The pointer to the Udp6 access point.
679 @param[in] IoStatus The status from Udp6 instance.
680 @param[in] Context The pointer to the context.
686 IN NET_BUF
*UdpPacket
,
687 IN UDP_END_POINT
*UdpEpt
,
688 IN EFI_STATUS IoStatus
,
692 MTFTP6_INSTANCE
*Instance
;
693 EFI_MTFTP6_PACKET
*Packet
;
701 Instance
= (MTFTP6_INSTANCE
*) Context
;
703 NET_CHECK_SIGNATURE (Instance
, MTFTP6_INSTANCE_SIGNATURE
);
705 Status
= EFI_SUCCESS
;
712 // Return error status if Udp6 instance failed to receive.
714 if (EFI_ERROR (IoStatus
)) {
719 ASSERT (UdpPacket
!= NULL
);
721 if (UdpPacket
->TotalSize
< MTFTP6_OPCODE_LEN
) {
726 // Find the port this packet is from to restart receive correctly.
729 Ip6Swap128 (&UdpEpt
->LocalAddr
.v6
),
731 sizeof (EFI_IPv6_ADDRESS
)
739 // Client send initial request to server's listening port. Server
740 // will select a UDP port to communicate with the client. The server
741 // is required to use the same port as RemotePort to multicast the
744 if (UdpEpt
->RemotePort
!= Instance
->ServerDataPort
) {
745 if (Instance
->ServerDataPort
!= 0) {
749 // For the subsequent exchange of requests, reconfigure the udpio as
750 // (serverip, serverport, localip, localport).
751 // Ususally, the client set serverport as 0 to receive and reset it
752 // once the first packet arrives to send ack.
754 Instance
->ServerDataPort
= UdpEpt
->RemotePort
;
759 // Copy the MTFTP packet to a continuous buffer if it isn't already so.
761 Len
= UdpPacket
->TotalSize
;
762 TotalNum
= UdpPacket
->BlockOpNum
;
765 Packet
= AllocateZeroPool (Len
);
767 if (Packet
== NULL
) {
768 Status
= EFI_OUT_OF_RESOURCES
;
772 NetbufCopy (UdpPacket
, 0, Len
, (UINT8
*) Packet
);
775 Packet
= (EFI_MTFTP6_PACKET
*) NetbufGetByte (UdpPacket
, 0, NULL
);
776 ASSERT (Packet
!= NULL
);
779 Opcode
= NTOHS (Packet
->OpCode
);
782 // Callback to the user's CheckPacket if provided. Abort the transmission
783 // if CheckPacket returns an EFI_ERROR code.
785 if ((Instance
->Token
->CheckPacket
!= NULL
) &&
786 (Opcode
== EFI_MTFTP6_OPCODE_OACK
|| Opcode
== EFI_MTFTP6_OPCODE_ERROR
)
789 Status
= Instance
->Token
->CheckPacket (
796 if (EFI_ERROR (Status
)) {
798 // Send an error message to the server to inform it
800 if (Opcode
!= EFI_MTFTP6_OPCODE_ERROR
) {
802 // Free the received packet before send new packet in ReceiveNotify,
803 // since the udpio might need to be reconfigured.
805 NetbufFree (UdpPacket
);
808 // Send the Mtftp6 error message if user aborted the current session.
812 EFI_MTFTP6_ERRORCODE_REQUEST_DENIED
,
813 (UINT8
*) "User aborted the transfer"
817 Status
= EFI_ABORTED
;
823 // Switch the process routines by the operation code.
826 case EFI_MTFTP6_OPCODE_DATA
:
827 if ((Len
> (UINT32
) (MTFTP6_DATA_HEAD_LEN
+ Instance
->BlkSize
)) || (Len
< (UINT32
) MTFTP6_DATA_HEAD_LEN
)) {
831 // Handle the data packet of Rrq.
833 Status
= Mtftp6RrqHandleData (
842 case EFI_MTFTP6_OPCODE_OACK
:
843 if (IsMcast
|| Len
<= MTFTP6_OPCODE_LEN
) {
847 // Handle the Oack packet of Rrq.
849 Status
= Mtftp6RrqHandleOack (
860 // Drop and return eror if received error message.
862 Status
= EFI_TFTP_ERROR
;
868 // Free the resources, then if !EFI_ERROR (Status), restart the
869 // receive, otherwise end the session.
871 if (Packet
!= NULL
&& TotalNum
> 1) {
874 if (UdpPacket
!= NULL
) {
875 NetbufFree (UdpPacket
);
877 if (!EFI_ERROR (Status
) && !IsCompleted
) {
879 Status
= UdpIoRecvDatagram (
880 Instance
->McastUdpIo
,
886 Status
= UdpIoRecvDatagram (
895 // Clean up the current session if failed to continue.
897 if (EFI_ERROR (Status
) || IsCompleted
) {
898 Mtftp6OperationClean (Instance
, Status
);
904 Start the Mtftp6 instance to download. It first initializes some
905 of the internal states, then builds and sends an RRQ reqeuest packet.
906 Finally, it starts receive for the downloading.
908 @param[in] Instance The pointer to the Mtftp6 instance.
909 @param[in] Operation The operation code of current packet.
911 @retval EFI_SUCCESS The Mtftp6 is started to download.
912 @retval Others Failed to start to download.
917 IN MTFTP6_INSTANCE
*Instance
,
924 // The valid block number range are [1, 0xffff]. For example:
925 // the client sends an RRQ request to the server, the server
926 // transfers the DATA1 block. If option negoitation is ongoing,
927 // the server will send back an OACK, then client will send ACK0.
929 Status
= Mtftp6InitBlockRange (&Instance
->BlkList
, 1, 0xffff);
931 if (EFI_ERROR (Status
)) {
935 Status
= Mtftp6SendRequest (Instance
, Operation
);
937 if (EFI_ERROR (Status
)) {
941 return UdpIoRecvDatagram (