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 <siyuan.fu@intel.com> Reviewed-by: Ye, Ting <ting.ye@intel.com> Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com> 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
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -267,151 +267,3 @@ Ip4NtohHead (
|
||||
|
||||
return Head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Ip4 variable data.
|
||||
|
||||
Save the list of all of the IPv4 addresses and subnet masks that are currently
|
||||
being used to volatile variable storage.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
@retval EFI_SUCCESS Successfully set variable.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4SetVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_IP4_VARIABLE_DATA *Ip4VariableData;
|
||||
EFI_IP4_ADDRESS_PAIR *Ip4AddressPair;
|
||||
IP4_PROTOCOL *IpInstance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP4_STATE_CONFIGED) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Ip4VariableData. As there may be no IP child,
|
||||
// we should add extra buffer for the address paris only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_IP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_IP4_ADDRESS_PAIR) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Ip4VariableData = AllocatePool (VariableDataSize);
|
||||
if (Ip4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Ip4VariableData->DriverHandle = IpSb->Image;
|
||||
Ip4VariableData->AddressCount = NumConfiguredInstance;
|
||||
|
||||
Ip4AddressPair = &Ip4VariableData->AddressPairs[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP4_STATE_CONFIGED) {
|
||||
Ip4AddressPair->InstanceHandle = IpInstance->Handle;
|
||||
EFI_IP4 (Ip4AddressPair->Ip4Address) = NTOHL (IpInstance->Interface->Ip);
|
||||
EFI_IP4 (Ip4AddressPair->SubnetMask) = NTOHL (IpInstance->Interface->SubnetMask);
|
||||
|
||||
Ip4AddressPair++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &NewMacString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (IpSb->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (IpSb->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
}
|
||||
|
||||
IpSb->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Ip4VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (Ip4VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip4ClearVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
ASSERT (IpSb->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
IpSb->MacString = NULL;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Common definition for IP4.
|
||||
|
||||
Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -201,33 +201,4 @@ Ip4NtohHead (
|
||||
IN IP4_HEAD *Head
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Ip4 variable data.
|
||||
|
||||
Save the list of all of the IPv4 addresses and subnet masks that are currently
|
||||
being used to volatile variable storage.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
@retval EFI_SUCCESS Successfully set variable.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4SetVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip4ClearVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
The driver binding and service binding protocol for IP4 driver.
|
||||
|
||||
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -297,8 +297,6 @@ Ip4CreateService (
|
||||
IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;
|
||||
}
|
||||
IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
|
||||
IpSb->MacString = NULL;
|
||||
|
||||
*Service = IpSb;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
@@ -519,8 +517,6 @@ Ip4DriverBindingStart (
|
||||
//
|
||||
mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
return Status;
|
||||
|
||||
UNINSTALL_PROTOCOL:
|
||||
@@ -716,11 +712,6 @@ Ip4DriverBindingStop (
|
||||
State = IpSb->State;
|
||||
IpSb->State = IP4_SERVICE_DESTROY;
|
||||
|
||||
//
|
||||
// Clear the variable data.
|
||||
//
|
||||
Ip4ClearVariableData (IpSb);
|
||||
|
||||
//
|
||||
// OK, clean other resources then uninstall the service binding protocol.
|
||||
//
|
||||
@@ -975,9 +966,6 @@ Ip4ServiceBindingDestroyChild (
|
||||
}
|
||||
|
||||
Status = Ip4CleanProtocol (IpInstance);
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ChildHandle,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -701,8 +701,6 @@ Ip4AutoConfigCallBackDpc (
|
||||
|
||||
IpSb->State = IP4_SERVICE_CONFIGED;
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
ON_EXIT:
|
||||
FreePool (Data);
|
||||
}
|
||||
@@ -1312,11 +1310,6 @@ EfiIp4Configure (
|
||||
//
|
||||
Ip4ServiceConfigMnp (IpInstance->Service, FALSE);
|
||||
|
||||
//
|
||||
// Update the variable data.
|
||||
//
|
||||
Ip4SetVariableData (IpInstance->Service);
|
||||
|
||||
ON_EXIT:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Ip4 internal functions and type defintions.
|
||||
|
||||
Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -202,11 +202,6 @@ struct _IP4_SERVICE {
|
||||
EFI_EVENT ReconfigEvent;
|
||||
EFI_EVENT ActiveEvent;
|
||||
|
||||
//
|
||||
// The string representation of the current mac address of the
|
||||
// NIC this IP4_SERVICE works on.
|
||||
//
|
||||
CHAR16 *MacString;
|
||||
UINT32 MaxPacketSize;
|
||||
UINT32 OldMaxPacketSize; ///< The MTU before IPsec enable.
|
||||
};
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Tcp request dispatcher implementation.
|
||||
|
||||
Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -237,8 +237,6 @@ Tcp4FlushPcb (
|
||||
);
|
||||
FreePool (Sock->DevicePath);
|
||||
}
|
||||
|
||||
TcpSetVariableData (TcpProto->TcpService);
|
||||
}
|
||||
|
||||
NetbufFreeList (&Tcb->SndQue);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Tcp driver function.
|
||||
|
||||
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -418,8 +418,6 @@ Tcp4DriverBindingStart (
|
||||
|
||||
InitializeListHead (&TcpServiceData->SocketList);
|
||||
|
||||
TcpSetVariableData (TcpServiceData);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
@@ -539,11 +537,6 @@ Tcp4DriverBindingStop (
|
||||
//
|
||||
Tcp4DestroyTimer ();
|
||||
|
||||
//
|
||||
// Clear the variable.
|
||||
//
|
||||
TcpClearVariableData (TcpServiceData);
|
||||
|
||||
if (gTcpControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (gTcpControllerNameTable);
|
||||
gTcpControllerNameTable = NULL;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Tcp driver function header.
|
||||
|
||||
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -48,7 +48,6 @@ typedef struct _TCP4_SERVICE_DATA {
|
||||
IP_IO *IpIo; // IP Io consumed by TCP4
|
||||
EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
CHAR16 *MacString;
|
||||
LIST_ENTRY SocketList;
|
||||
} TCP4_SERVICE_DATA;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Tcp function header file.
|
||||
|
||||
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -764,31 +764,6 @@ TcpBackoffRto (
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Tdp4 variable data.
|
||||
|
||||
@param Tcp4Service Pointer to Tcp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpSetVariableData (
|
||||
IN TCP4_SERVICE_DATA *Tcp4Service
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param Tcp4Service Pointer to Tcp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
TcpClearVariableData (
|
||||
IN TCP4_SERVICE_DATA *Tcp4Service
|
||||
);
|
||||
|
||||
/**
|
||||
Install the device path protocol on the TCP instance.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Misc support routines for tcp.
|
||||
|
||||
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -392,7 +392,6 @@ TcpInsertTcb (
|
||||
InsertHeadList (Head, &Tcb->List);
|
||||
|
||||
TcpProto = (TCP4_PROTO_DATA *) Tcb->Sk->ProtoReserved;
|
||||
TcpSetVariableData (TcpProto->TcpService);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -878,205 +877,6 @@ TcpOnAppAbort (
|
||||
TcpSetState (Tcb, TCP_CLOSED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Tdp4 variable data.
|
||||
|
||||
@param Tcp4Service Pointer to Tcp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpSetVariableData (
|
||||
IN TCP4_SERVICE_DATA *Tcp4Service
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *TcpPcb;
|
||||
TCP4_PROTO_DATA *TcpProto;
|
||||
UINTN VariableDataSize;
|
||||
EFI_TCP4_VARIABLE_DATA *Tcp4VariableData;
|
||||
EFI_TCP4_SERVICE_POINT *Tcp4ServicePoint;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the running queue to count the instances.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {
|
||||
TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == Tcp4Service) {
|
||||
//
|
||||
// This tcp instance belongs to the Tcp4Service.
|
||||
//
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Go through the listening queue to count the instances.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {
|
||||
TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == Tcp4Service) {
|
||||
//
|
||||
// This tcp instance belongs to the Tcp4Service.
|
||||
//
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,
|
||||
// we should add extra buffer for the service points only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Tcp4VariableData = AllocatePool (VariableDataSize);
|
||||
if (Tcp4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Tcp4VariableData->DriverHandle = Tcp4Service->DriverBindingHandle;
|
||||
Tcp4VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Tcp4ServicePoint = &Tcp4VariableData->Services[0];
|
||||
|
||||
//
|
||||
// Go through the running queue to fill the service points.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {
|
||||
TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == Tcp4Service) {
|
||||
//
|
||||
// This tcp instance belongs to the Tcp4Service.
|
||||
//
|
||||
Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
|
||||
CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
|
||||
CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
|
||||
|
||||
Tcp4ServicePoint++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Go through the listening queue to fill the service points.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {
|
||||
TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == Tcp4Service) {
|
||||
//
|
||||
// This tcp instance belongs to the Tcp4Service.
|
||||
//
|
||||
Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
|
||||
CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
|
||||
CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
|
||||
|
||||
Tcp4ServicePoint++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (
|
||||
Tcp4Service->ControllerHandle,
|
||||
Tcp4Service->DriverBindingHandle,
|
||||
&NewMacString
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (Tcp4Service->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (Tcp4Service->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
Tcp4Service->MacString,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (Tcp4Service->MacString);
|
||||
}
|
||||
|
||||
Tcp4Service->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
Tcp4Service->MacString,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Tcp4VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (Tcp4VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param Tcp4Service Pointer to Tcp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
TcpClearVariableData (
|
||||
IN TCP4_SERVICE_DATA *Tcp4Service
|
||||
)
|
||||
{
|
||||
ASSERT (Tcp4Service->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
Tcp4Service->MacString,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (Tcp4Service->MacString);
|
||||
Tcp4Service->MacString = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Install the device path protocol on the TCP instance.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -181,8 +181,6 @@ Udp4DriverBindingStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
Udp4CleanService (Udp4Service);
|
||||
FreePool (Udp4Service);
|
||||
} else {
|
||||
Udp4SetVariableData (Udp4Service);
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -268,9 +266,7 @@ Udp4DriverBindingStop (
|
||||
&Udp4Service->ServiceBinding,
|
||||
NULL
|
||||
);
|
||||
|
||||
Udp4ClearVariableData (Udp4Service);
|
||||
|
||||
|
||||
Udp4CleanService (Udp4Service);
|
||||
|
||||
if (gUdpControllerNameTable != NULL) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
The implementation of the Udp4 protocol.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -1633,8 +1633,6 @@ Udp4Demultiplex (
|
||||
}
|
||||
}
|
||||
|
||||
gRT->GetTime (&RxData.TimeStamp, NULL);
|
||||
|
||||
Udp4Session = &RxData.UdpSession;
|
||||
Udp4Session->SourcePort = NTOHS (Udp4Header->SrcPort);
|
||||
Udp4Session->DestinationPort = NTOHS (Udp4Header->DstPort);
|
||||
@@ -1896,166 +1894,4 @@ Udp4NetVectorExtFree (
|
||||
VOID *Context
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Udp4 variable data.
|
||||
|
||||
@param[in] Udp4Service Udp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval EFI_SUCCESS Set variable successfully.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp4SetVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_UDP4_VARIABLE_DATA *Udp4VariableData;
|
||||
EFI_UDP4_SERVICE_POINT *Udp4ServicePoint;
|
||||
UDP4_INSTANCE_DATA *Udp4Instance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
|
||||
Udp4Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP4_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP4_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp4Instance->Configured) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Udp4VariableData. As there may be no Udp4 child,
|
||||
// we should add extra buffer for the service points only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_UDP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_UDP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Udp4VariableData = AllocatePool (VariableDataSize);
|
||||
if (Udp4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Udp4VariableData->DriverHandle = Udp4Service->ImageHandle;
|
||||
Udp4VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Udp4ServicePoint = &Udp4VariableData->Services[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
|
||||
Udp4Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP4_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP4_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp4Instance->Configured) {
|
||||
Udp4ServicePoint->InstanceHandle = Udp4Instance->ChildHandle;
|
||||
Udp4ServicePoint->LocalAddress = Udp4Instance->ConfigData.StationAddress;
|
||||
Udp4ServicePoint->LocalPort = Udp4Instance->ConfigData.StationPort;
|
||||
Udp4ServicePoint->RemoteAddress = Udp4Instance->ConfigData.RemoteAddress;
|
||||
Udp4ServicePoint->RemotePort = Udp4Instance->ConfigData.RemotePort;
|
||||
|
||||
Udp4ServicePoint++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (
|
||||
Udp4Service->ControllerHandle,
|
||||
Udp4Service->ImageHandle,
|
||||
&NewMacString
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (Udp4Service->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (Udp4Service->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (Udp4Service->MacString);
|
||||
}
|
||||
|
||||
Udp4Service->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Udp4VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (Udp4VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[[in] Udp4Service Udp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp4ClearVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
)
|
||||
{
|
||||
ASSERT (Udp4Service->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (Udp4Service->MacString);
|
||||
Udp4Service->MacString = NULL;
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
EFI UDPv4 protocol implementation.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -72,8 +72,6 @@ typedef struct _UDP4_SERVICE_DATA_ {
|
||||
IP_IO *IpIo;
|
||||
|
||||
EFI_EVENT TimeoutEvent;
|
||||
|
||||
CHAR16 *MacString;
|
||||
} UDP4_SERVICE_DATA;
|
||||
|
||||
#define UDP4_INSTANCE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', 'I')
|
||||
@@ -693,33 +691,5 @@ EFIAPI
|
||||
Udp4NetVectorExtFree (
|
||||
VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Udp4 variable data.
|
||||
|
||||
@param[in] Udp4Service Udp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval EFI_SUCCESS Set variable successfully.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp4SetVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[[in] Udp4Service Udp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp4ClearVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -280,9 +280,7 @@ Udp4Configure (
|
||||
|
||||
ASSERT (IsListEmpty (&Instance->DeliveredDgramQue));
|
||||
}
|
||||
|
||||
Udp4SetVariableData (Instance->Udp4Service);
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
Reference in New Issue
Block a user