From d551cc64cdf1f943744294819220b78a60b10822 Mon Sep 17 00:00:00 2001 From: Fu Siyuan Date: Wed, 7 May 2014 06:17:31 +0000 Subject: 1. Mark the network volatile variables as deprecated in code comments and remove related code to set/get these variable. 2. Remove the GetTime() call when receiving Udp4/6 packets. Signed-off-by: Fu Siyuan Reviewed-by: Ye, Ting Reviewed-by: Wu, Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15497 6f19259b-4bc3-4df7-8a09-765794883524 --- NetworkPkg/Udp6Dxe/Udp6Driver.c | 8 +- NetworkPkg/Udp6Dxe/Udp6Impl.c | 174 +--------------------------------------- NetworkPkg/Udp6Dxe/Udp6Impl.h | 35 +------- NetworkPkg/Udp6Dxe/Udp6Main.c | 8 +- 4 files changed, 11 insertions(+), 214 deletions(-) (limited to 'NetworkPkg/Udp6Dxe') diff --git a/NetworkPkg/Udp6Dxe/Udp6Driver.c b/NetworkPkg/Udp6Dxe/Udp6Driver.c index 1c2c33336e..da2093962a 100644 --- a/NetworkPkg/Udp6Dxe/Udp6Driver.c +++ b/NetworkPkg/Udp6Dxe/Udp6Driver.c @@ -1,7 +1,7 @@ /** @file Driver Binding functions and Service Binding functions for the Network driver module. - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 @@ -165,8 +165,6 @@ Udp6DriverBindingStart ( if (EFI_ERROR (Status)) { Udp6CleanService (Udp6Service); goto EXIT; - } else { - Status = Udp6SetVariableData (Udp6Service); } EXIT: @@ -298,9 +296,7 @@ Udp6DriverBindingStop ( &Udp6Service->ServiceBinding, NULL ); - - Udp6ClearVariableData (Udp6Service); - + Udp6CleanService (Udp6Service); FreePool (Udp6Service); diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c index 3830b14415..40e3aff069 100644 --- a/NetworkPkg/Udp6Dxe/Udp6Impl.c +++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c @@ -1,7 +1,7 @@ /** @file Udp6 driver's whole implementation. - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 @@ -1623,8 +1623,6 @@ Udp6Demultiplex ( } } - gRT->GetTime (&RxData.TimeStamp, NULL); - Udp6Session = &RxData.UdpSession; Udp6Session->SourcePort = NTOHS (Udp6Header->SrcPort); Udp6Session->DestinationPort = NTOHS (Udp6Header->DstPort); @@ -1933,175 +1931,7 @@ Udp6NetVectorExtFree ( IN VOID *Context ) { -} - - -/** - Set the Udp6 variable data. - - @param[in] Udp6Service Udp6 service data. - - @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the - variable. - @retval other Set variable failed. - -**/ -EFI_STATUS -Udp6SetVariableData ( - IN UDP6_SERVICE_DATA *Udp6Service - ) -{ - UINT32 NumConfiguredInstance; - LIST_ENTRY *Entry; - UINTN VariableDataSize; - EFI_UDP6_VARIABLE_DATA *Udp6VariableData; - EFI_UDP6_SERVICE_POINT *Udp6ServicePoint; - UDP6_INSTANCE_DATA *Udp6Instance; - CHAR16 *NewMacString; - EFI_STATUS Status; - - NumConfiguredInstance = 0; - - // - // Go through the children list to count the configured children. - // - NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) { - Udp6Instance = NET_LIST_USER_STRUCT_S ( - Entry, - UDP6_INSTANCE_DATA, - Link, - UDP6_INSTANCE_DATA_SIGNATURE - ); - - if (Udp6Instance->Configured) { - NumConfiguredInstance++; - } - } - - // - // Calculate the size of the Udp6VariableData. As there may be no Udp6 child, - // we should add extra buffer for the service points only if the number of configured - // children is more than 1. - // - VariableDataSize = sizeof (EFI_UDP6_VARIABLE_DATA); - - if (NumConfiguredInstance > 1) { - VariableDataSize += sizeof (EFI_UDP6_SERVICE_POINT) * (NumConfiguredInstance - 1); - } - - Udp6VariableData = AllocateZeroPool (VariableDataSize); - if (Udp6VariableData == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Udp6VariableData->DriverHandle = Udp6Service->ImageHandle; - Udp6VariableData->ServiceCount = NumConfiguredInstance; - - Udp6ServicePoint = &Udp6VariableData->Services[0]; - - // - // Go through the children list to fill the configured children's address pairs. - // - NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) { - Udp6Instance = NET_LIST_USER_STRUCT_S ( - Entry, - UDP6_INSTANCE_DATA, - Link, - UDP6_INSTANCE_DATA_SIGNATURE - ); - - if (Udp6Instance->Configured) { - Udp6ServicePoint->InstanceHandle = Udp6Instance->ChildHandle; - Udp6ServicePoint->LocalPort = Udp6Instance->ConfigData.StationPort; - Udp6ServicePoint->RemotePort = Udp6Instance->ConfigData.RemotePort; - - IP6_COPY_ADDRESS ( - &Udp6ServicePoint->LocalAddress, - &Udp6Instance->ConfigData.StationAddress - ); - IP6_COPY_ADDRESS ( - &Udp6ServicePoint->RemoteAddress, - &Udp6Instance->ConfigData.RemoteAddress - ); - Udp6ServicePoint++; - } - } - - // - // Get the MAC string. - // - Status = NetLibGetMacString ( - Udp6Service->ControllerHandle, - Udp6Service->ImageHandle, - &NewMacString - ); - if (EFI_ERROR (Status)) { - goto EXIT; - } - - if (Udp6Service->MacString != NULL) { - // - // The variable is set already, we're going to update it. - // - if (StrCmp (Udp6Service->MacString, NewMacString) != 0) { - // - // The MAC address is changed, delete the previous variable first. - // - gRT->SetVariable ( - Udp6Service->MacString, - &gEfiUdp6ServiceBindingProtocolGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS, - 0, - NULL - ); - } - - FreePool (Udp6Service->MacString); - } - - Udp6Service->MacString = NewMacString; - - Status = gRT->SetVariable ( - Udp6Service->MacString, - &gEfiUdp6ServiceBindingProtocolGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS, - VariableDataSize, - (VOID *) Udp6VariableData - ); - -EXIT: - - FreePool (Udp6VariableData); - - return Status; -} - - -/** - Clear the variable and free the resource. - - @param[in, out] Udp6Service Udp6 service data. - -**/ -VOID -Udp6ClearVariableData ( - IN OUT UDP6_SERVICE_DATA *Udp6Service - ) -{ - ASSERT (Udp6Service->MacString != NULL); - - gRT->SetVariable ( - Udp6Service->MacString, - &gEfiUdp6ServiceBindingProtocolGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS, - 0, - NULL - ); - - FreePool (Udp6Service->MacString); - Udp6Service->MacString = NULL; -} - +} /** Find the key in the netmap. diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.h b/NetworkPkg/Udp6Dxe/Udp6Impl.h index 9ca4f4a011..09f315f50b 100644 --- a/NetworkPkg/Udp6Dxe/Udp6Impl.h +++ b/NetworkPkg/Udp6Dxe/Udp6Impl.h @@ -1,7 +1,7 @@ /** @file Udp6 driver's whole implementation and internal data structures. - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 @@ -79,8 +79,7 @@ typedef struct _UDP6_SERVICE_DATA { UINTN ChildrenNumber; IP_IO *IpIo; EFI_EVENT TimeoutEvent; - CHAR16 *MacString; -} UDP6_SERVICE_DATA; + } UDP6_SERVICE_DATA; typedef struct _UDP6_INSTANCE_DATA { UINT32 Signature; @@ -145,22 +144,7 @@ Udp6CreateService ( IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle ); - -/** - Set the Udp6 variable data. - - @param[in] Udp6Service Udp6 service data. - - @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the - variable. - @retval other Set variable failed. - -**/ -EFI_STATUS -Udp6SetVariableData ( - IN UDP6_SERVICE_DATA *Udp6Service - ); - + /** This function cleans the udp instance. @@ -171,18 +155,7 @@ VOID Udp6CleanInstance ( IN OUT UDP6_INSTANCE_DATA *Instance ); - -/** - Clear the variable and free the resource. - - @param[in, out] Udp6Service Udp6 service data. - -**/ -VOID -Udp6ClearVariableData ( - IN OUT UDP6_SERVICE_DATA *Udp6Service - ); - + /** This function intializes the new created udp instance. diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c index 0cad596276..f3e99255f9 100644 --- a/NetworkPkg/Udp6Dxe/Udp6Main.c +++ b/NetworkPkg/Udp6Dxe/Udp6Main.c @@ -1,7 +1,7 @@ /** @file Contains all EFI_UDP6_PROTOCOL interfaces. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 @@ -275,7 +275,7 @@ Udp6Configure ( // // Cancel all the user tokens. // - Status = Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL); + Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL); // // Remove the buffered RxData for this instance. @@ -284,9 +284,7 @@ Udp6Configure ( ASSERT (IsListEmpty (&Instance->DeliveredDgramQue)); } - - Status = Udp6SetVariableData (Instance->Udp6Service); - + ON_EXIT: gBS->RestoreTPL (OldTpl); -- cgit v1.2.3