Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
r58459 r77662 2 2 Help functions to access UDP service, it is used by both the DHCP and MTFTP. 3 3 4 Copyright (c) 2005 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 216 216 // 217 217 if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) { 218 if (((EFI_UDP4_RECEIVE_DATA *) RxData)->DataLength == 0) { 219 // 220 // Discard zero length data payload packet. 221 // 222 goto Resume; 223 } 218 224 219 225 Netbuf = NetbufFromExt ( … … 253 259 EndPoint.RemoteAddr.Addr[0] = NTOHL (EndPoint.RemoteAddr.Addr[0]); 254 260 } else { 261 if (((EFI_UDP6_RECEIVE_DATA *) RxData)->DataLength == 0) { 262 // 263 // Discard zero length data payload packet. 264 // 265 goto Resume; 266 } 255 267 256 268 Netbuf = NetbufFromExt ( … … 292 304 293 305 RxToken->CallBack (Netbuf, &EndPoint, EFI_SUCCESS, RxToken->Context); 306 return; 307 308 Resume: 309 if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) { 310 gBS->SignalEvent (((EFI_UDP4_RECEIVE_DATA *) RxData)->RecycleSignal); 311 RxToken->UdpIo->Protocol.Udp4->Receive (RxToken->UdpIo->Protocol.Udp4, &RxToken->Token.Udp4); 312 } else { 313 gBS->SignalEvent (((EFI_UDP6_RECEIVE_DATA *) RxData)->RecycleSignal); 314 RxToken->UdpIo->Protocol.Udp6->Receive (RxToken->UdpIo->Protocol.Udp6, &RxToken->Token.Udp6); 315 } 294 316 } 295 317 … … 389 411 Wrap a transmit request into a new created UDP_TX_TOKEN. 390 412 413 If Packet is NULL, then ASSERT(). 414 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 415 391 416 @param[in] UdpIo The UdpIo to send packet to. 392 417 @param[in] Packet The user's packet. … … 558 583 Creates a UDP_IO to access the UDP service. It creates and configures 559 584 a UDP child. 585 586 If Configure is NULL, then ASSERT(). 587 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 560 588 561 589 It locates the UDP service binding prototype on the Controller parameter … … 728 756 /** 729 757 Cancel all the sent datagram that pass the selection criteria of ToCancel. 758 730 759 If ToCancel is NULL, all the datagrams are cancelled. 760 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 731 761 732 762 @param[in] UdpIo The UDP_IO to cancel packet. … … 743 773 IN EFI_STATUS IoStatus, 744 774 IN UDP_IO_TO_CANCEL ToCancel, OPTIONAL 745 IN VOID *Context 775 IN VOID *Context OPTIONAL 746 776 ) 747 777 { … … 770 800 Free the UDP_IO and all its related resources. 771 801 802 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 803 772 804 The function will cancel all sent datagram and receive request. 773 805 … … 775 807 776 808 @retval EFI_SUCCESS The UDP_IO is freed. 809 @retval Others Failed to free UDP_IO. 777 810 778 811 **/ … … 783 816 ) 784 817 { 818 EFI_STATUS Status; 785 819 UDP_RX_TOKEN *RxToken; 786 820 … … 801 835 802 836 if ((RxToken = UdpIo->RecvRequest) != NULL) { 803 UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4); 837 Status = UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4); 838 if (EFI_ERROR (Status)) { 839 return Status; 840 } 804 841 } 805 842 … … 807 844 // Close then destroy the Udp4 child 808 845 // 809 gBS->CloseProtocol ( 810 UdpIo->UdpHandle, 811 &gEfiUdp4ProtocolGuid, 812 UdpIo->Image, 813 UdpIo->Controller 814 ); 815 816 NetLibDestroyServiceChild ( 817 UdpIo->Controller, 818 UdpIo->Image, 819 &gEfiUdp4ServiceBindingProtocolGuid, 820 UdpIo->UdpHandle 821 ); 846 Status = gBS->CloseProtocol ( 847 UdpIo->UdpHandle, 848 &gEfiUdp4ProtocolGuid, 849 UdpIo->Image, 850 UdpIo->Controller 851 ); 852 if (EFI_ERROR (Status)) { 853 return Status; 854 } 855 856 Status = NetLibDestroyServiceChild ( 857 UdpIo->Controller, 858 UdpIo->Image, 859 &gEfiUdp4ServiceBindingProtocolGuid, 860 UdpIo->UdpHandle 861 ); 862 if (EFI_ERROR (Status)) { 863 return Status; 864 } 822 865 823 866 } else { 824 867 825 868 if ((RxToken = UdpIo->RecvRequest) != NULL) { 826 UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6); 869 Status = UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6); 870 if (EFI_ERROR (Status)) { 871 return Status; 872 } 827 873 } 828 874 … … 830 876 // Close then destroy the Udp6 child 831 877 // 832 gBS->CloseProtocol ( 833 UdpIo->UdpHandle, 834 &gEfiUdp6ProtocolGuid, 835 UdpIo->Image, 836 UdpIo->Controller 837 ); 838 839 NetLibDestroyServiceChild ( 840 UdpIo->Controller, 841 UdpIo->Image, 842 &gEfiUdp6ServiceBindingProtocolGuid, 843 UdpIo->UdpHandle 844 ); 845 } 878 Status = gBS->CloseProtocol ( 879 UdpIo->UdpHandle, 880 &gEfiUdp6ProtocolGuid, 881 UdpIo->Image, 882 UdpIo->Controller 883 ); 884 if (EFI_ERROR (Status)) { 885 return Status; 886 } 887 888 Status = NetLibDestroyServiceChild ( 889 UdpIo->Controller, 890 UdpIo->Image, 891 &gEfiUdp6ServiceBindingProtocolGuid, 892 UdpIo->UdpHandle 893 ); 894 if (EFI_ERROR (Status)) { 895 return Status; 896 } 897 } 846 898 847 899 if (!IsListEmpty(&UdpIo->Link)) { … … 857 909 Clean up the UDP_IO without freeing it. The function is called when 858 910 user wants to re-use the UDP_IO later. 911 912 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 859 913 860 914 It will release all the transmitted datagrams and receive request. It will … … 898 952 /** 899 953 Send a packet through the UDP_IO. 954 955 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 900 956 901 957 The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called … … 1009 1065 Issue a receive request to the UDP_IO. 1010 1066 1067 If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT(). 1068 1011 1069 This function is called when upper-layer needs packet from UDP for processing. 1012 1070 Only one receive request is acceptable at a time so a common usage model is
Note:
See TracChangeset
for help on using the changeset viewer.