diff options
author | Fu Siyuan <siyuan.fu@intel.com> | 2014-05-07 06:17:31 +0000 |
---|---|---|
committer | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-05-07 06:17:31 +0000 |
commit | d551cc64cdf1f943744294819220b78a60b10822 (patch) | |
tree | 2d101c7186e6cda17743a85dda99c975e3d33d01 /NetworkPkg/TcpDxe/TcpMisc.c | |
parent | 5966402ed51c5b611bf437c812047dc9c432a47e (diff) | |
download | edk2-platforms-d551cc64cdf1f943744294819220b78a60b10822.tar.xz |
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
Diffstat (limited to 'NetworkPkg/TcpDxe/TcpMisc.c')
-rw-r--r-- | NetworkPkg/TcpDxe/TcpMisc.c | 263 |
1 files changed, 1 insertions, 262 deletions
diff --git a/NetworkPkg/TcpDxe/TcpMisc.c b/NetworkPkg/TcpDxe/TcpMisc.c index 21bd9dfec1..5394f7d1ca 100644 --- a/NetworkPkg/TcpDxe/TcpMisc.c +++ b/NetworkPkg/TcpDxe/TcpMisc.c @@ -1,7 +1,7 @@ /** @file
Misc support routines for TCP driver.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 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
@@ -467,7 +467,6 @@ TcpInsertTcb ( InsertHeadList (Head, &Tcb->List);
TcpProto = (TCP_PROTO_DATA *) Tcb->Sk->ProtoReserved;
- TcpSetVariableData (TcpProto->TcpService);
return 0;
}
@@ -944,266 +943,6 @@ TcpResetConnection ( }
/**
- Set the Tcp variable data.
-
- @param[in] TcpService Tcp 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 TCP_SERVICE_DATA *TcpService
- )
-{
- EFI_GUID *ServiceBindingGuid;
- UINT32 NumConfiguredInstance;
- LIST_ENTRY *Entry;
- TCP_CB *TcpPcb;
- TCP_PROTO_DATA *TcpProto;
- UINTN VariableDataSize;
- EFI_TCP4_VARIABLE_DATA *Tcp4VariableData;
- EFI_TCP4_SERVICE_POINT *Tcp4ServicePoint;
- EFI_TCP6_VARIABLE_DATA *Tcp6VariableData;
- EFI_TCP6_SERVICE_POINT *Tcp6ServicePoint;
- VOID *VariableData;
- CHAR16 *NewMacString;
- EFI_STATUS Status;
-
- if (TcpService->IpVersion == IP_VERSION_4) {
- ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
- } else {
- ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
- }
-
- NumConfiguredInstance = 0;
- Tcp4VariableData = NULL;
- Tcp6VariableData = NULL;
-
- //
- // 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == TcpService) {
- //
- // This tcp instance belongs to the TcpService.
- //
- 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == TcpService) {
- //
- // This tcp instance belongs to the TcpService.
- //
- NumConfiguredInstance++;
- }
- }
-
- Tcp4ServicePoint = NULL;
- Tcp6ServicePoint = NULL;
-
- //
- // Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,
- // we should add extra buffers for the service points only if the number of configured
- // children is more than one.
- //
- if (TcpService->IpVersion == IP_VERSION_4) {
- VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);
-
- if (NumConfiguredInstance > 1) {
- VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
- }
-
- Tcp4VariableData = AllocateZeroPool (VariableDataSize);
- if (Tcp4VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Tcp4VariableData->DriverHandle = TcpService->DriverBindingHandle;
- Tcp4VariableData->ServiceCount = NumConfiguredInstance;
-
- Tcp4ServicePoint = &Tcp4VariableData->Services[0];
- VariableData = Tcp4VariableData;
- } else {
- VariableDataSize = sizeof (EFI_TCP6_VARIABLE_DATA);
-
- if (NumConfiguredInstance > 1) {
- VariableDataSize += sizeof (EFI_TCP6_SERVICE_POINT) * (NumConfiguredInstance - 1);
- }
-
- Tcp6VariableData = AllocateZeroPool (VariableDataSize);
- if (Tcp6VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Tcp6VariableData->DriverHandle = TcpService->DriverBindingHandle;
- Tcp6VariableData->ServiceCount = NumConfiguredInstance;
-
- Tcp6ServicePoint = &Tcp6VariableData->Services[0];
- VariableData = Tcp6VariableData;
- }
-
- //
- // 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == TcpService) {
- //
- // This tcp instance belongs to the TcpService.
- //
- if (TcpService->IpVersion == IP_VERSION_4) {
- 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++;
- } else {
- Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
- IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);
- Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
- IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);
- Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
-
- Tcp6ServicePoint++;
- }
- }
- }
-
- //
- // 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == TcpService) {
- //
- // This tcp instance belongs to the TcpService.
- //
- if (TcpService->IpVersion == IP_VERSION_4) {
- 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++;
- } else {
- Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
- IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);
- Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
- IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);
- Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
-
- Tcp6ServicePoint++;
- }
- }
- }
-
- //
- // Get the mac string.
- //
- Status = NetLibGetMacString (
- TcpService->ControllerHandle,
- TcpService->DriverBindingHandle,
- &NewMacString
- );
- if (EFI_ERROR (Status)) {
- goto ON_ERROR;
- }
-
- if (TcpService->MacString != NULL) {
- //
- // The variable is set already. We're going to update it.
- //
- if (StrCmp (TcpService->MacString, NewMacString) != 0) {
- //
- // The mac address is changed. Delete the previous variable first.
- //
- gRT->SetVariable (
- TcpService->MacString,
- ServiceBindingGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- 0,
- NULL
- );
- }
-
- FreePool (TcpService->MacString);
- }
-
- TcpService->MacString = NewMacString;
-
- Status = gRT->SetVariable (
- TcpService->MacString,
- ServiceBindingGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- VariableDataSize,
- VariableData
- );
-
-ON_ERROR:
-
- FreePool (VariableData);
-
- return Status;
-}
-
-/**
- Clear the variable and free the resource.
-
- @param[in] TcpService Tcp service data.
-
-**/
-VOID
-TcpClearVariableData (
- IN TCP_SERVICE_DATA *TcpService
- )
-{
- EFI_GUID *ServiceBindingGuid;
-
- ASSERT (TcpService->MacString != NULL);
-
- if (TcpService->IpVersion == IP_VERSION_4) {
- ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
- } else {
- ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
- }
-
- gRT->SetVariable (
- TcpService->MacString,
- ServiceBindingGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- 0,
- NULL
- );
-
- FreePool (TcpService->MacString);
- TcpService->MacString = NULL;
-}
-
-/**
Install the device path protocol on the TCP instance.
@param[in] Sock Pointer to the socket representing the TCP instance.
|