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:
Fu Siyuan
2014-05-07 06:17:31 +00:00
committed by sfu5
parent 5966402ed5
commit d551cc64cd
33 changed files with 87 additions and 1366 deletions

View File

@@ -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.