]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Driver.c
index 7a0f18af28c7684e3ab7b4f4fa045d83ec0f4e70..b3a877c9ef4ef446f1c48ac78ca6d473363765fb 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   The driver binding and service binding protocol for IP4 driver.\r
-  \r
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+\r
+Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -27,7 +27,7 @@ EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding = {
   This is the declaration of an EFI image entry point. This entry point is\r
   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
   both device drivers and bus drivers.\r
-  \r
+\r
   The entry point for IP4 driver which install the driver\r
   binding and component name protocol on its image.\r
 \r
@@ -290,6 +290,13 @@ Ip4CreateService (
 \r
   InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);\r
 \r
+  IpSb->MaxPacketSize = IpSb->SnpMode.MaxPacketSize - sizeof (IP4_HEAD);\r
+  if (NetLibGetVlanId (IpSb->Controller) != 0) {\r
+    //\r
+    // This is a VLAN device, reduce MTU by VLAN tag length\r
+    //\r
+    IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;\r
+  }\r
   IpSb->MacString = NULL;\r
 \r
   *Service = IpSb;\r
@@ -297,7 +304,7 @@ Ip4CreateService (
 \r
 ON_ERROR:\r
   Ip4CleanService (IpSb);\r
-  gBS->FreePool (IpSb);\r
+  FreePool (IpSb);\r
 \r
   return Status;\r
 }\r
@@ -439,6 +446,7 @@ Ip4DriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+  ASSERT (IpSb != NULL);\r
 \r
   //\r
   // Install the Ip4ServiceBinding Protocol onto ControlerHandle\r
@@ -487,7 +495,7 @@ UNINSTALL_PROTOCOL:
 \r
 FREE_SERVICE:\r
   Ip4CleanService (IpSb);\r
-  gBS->FreePool (IpSb);\r
+  FreePool (IpSb);\r
 \r
   return Status;\r
 }\r
@@ -500,7 +508,7 @@ FREE_SERVICE:
   restrictions for this service. DisconnectController()\r
   must follow these calling restrictions. If any other agent wishes\r
   to call Stop() it must also follow these calling restrictions.\r
-  \r
+\r
   @param[in]  This              Protocol instance pointer.\r
   @param[in]  ControllerHandle  Handle of device to stop driver on\r
   @param[in]  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number\r
@@ -685,7 +693,7 @@ Ip4DriverBindingStop (
            ServiceBinding\r
            );\r
 \r
-    gBS->FreePool (IpSb);\r
+    FreePool (IpSb);\r
   } else if (NumberOfChildren == 0) {\r
     IpSb->InDestory = TRUE;\r
 \r
@@ -713,7 +721,7 @@ Ip4DriverBindingStop (
            ServiceBinding\r
            );\r
 \r
-    gBS->FreePool (IpSb);\r
+    FreePool (IpSb);\r
   } else {\r
 \r
     while (!IsListEmpty (&IpSb->Children)) {\r
@@ -736,14 +744,14 @@ ON_ERROR:
 \r
 /**\r
   Creates a child handle and installs a protocol.\r
-  \r
-  The CreateChild() function installs a protocol on ChildHandle. \r
-  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r
+\r
+  The CreateChild() function installs a protocol on ChildHandle.\r
+  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
   If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   @param  ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
-                      then a new handle is created. If it is a pointer to an existing UEFI handle, \r
+                      then a new handle is created. If it is a pointer to an existing UEFI handle,\r
                       then the protocol is added to the existing UEFI handle.\r
 \r
   @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
@@ -833,7 +841,7 @@ ON_ERROR:
 \r
     Ip4CleanProtocol (IpInstance);\r
 \r
-    gBS->FreePool (IpInstance);\r
+    FreePool (IpInstance);\r
   }\r
 \r
   return Status;\r
@@ -842,9 +850,9 @@ ON_ERROR:
 \r
 /**\r
   Destroys a child handle with a protocol installed on it.\r
-  \r
-  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r
-  that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r
+\r
+  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
+  that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
   last protocol on ChildHandle, then ChildHandle is destroyed.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
@@ -970,7 +978,7 @@ Ip4ServiceBindingDestroyChild (
 \r
   gBS->RestoreTPL (OldTpl);\r
 \r
-  gBS->FreePool (IpInstance);\r
+  FreePool (IpInstance);\r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r