]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
Fix a bug for vlan ping failure.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpIo.c
index 1aa3207ea357d2d4ba6705e9d4c4e086ee7ca894..b8f61bf696fe1d82e45b9122202e18ee59da1d67 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of Managed Network Protocol I/O functions.\r
 \r
 /** @file\r
   Implementation of Managed Network Protocol I/O functions.\r
 \r
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -130,10 +130,20 @@ MnpBuildTxPacket (
   MnpDerviceData = MnpServiceData->MnpDeviceData;\r
   if ((TxData->DestinationAddress == NULL) && (TxData->FragmentCount == 1)) {\r
     //\r
   MnpDerviceData = MnpServiceData->MnpDeviceData;\r
   if ((TxData->DestinationAddress == NULL) && (TxData->FragmentCount == 1)) {\r
     //\r
-    // Media header is in FragmentTable and there is only one fragment,\r
-    // use fragment buffer directly.\r
+    // Reserve space for vlan tag,if necessary.\r
     //\r
     //\r
-    *PktBuf = TxData->FragmentTable[0].FragmentBuffer;\r
+    if (MnpServiceData->VlanId != 0) {\r
+      *PktBuf = MnpDerviceData->TxBuf + NET_VLAN_TAG_LEN;\r
+    } else {\r
+      *PktBuf = MnpDerviceData->TxBuf;\r
+    } \r
+    \r
+    CopyMem (\r
+        *PktBuf,\r
+        TxData->FragmentTable[0].FragmentBuffer,\r
+        TxData->FragmentTable[0].FragmentLength\r
+        );\r
+    \r
     *PktLen = TxData->FragmentTable[0].FragmentLength;\r
   } else {\r
     //\r
     *PktLen = TxData->FragmentTable[0].FragmentLength;\r
   } else {\r
     //\r
@@ -235,10 +245,15 @@ MnpSyncSendPacket (
     goto SIGNAL_TOKEN;\r
   }\r
 \r
     goto SIGNAL_TOKEN;\r
   }\r
 \r
-  //\r
-  // Insert VLAN tag\r
-  //\r
-  MnpInsertVlanTag (MnpServiceData, TxData, &ProtocolType, &Packet, &Length);\r
+  \r
+  if (MnpServiceData->VlanId != 0) {\r
+    //\r
+    // Insert VLAN tag\r
+    //\r
+    MnpInsertVlanTag (MnpServiceData, TxData, &ProtocolType, &Packet, &Length);\r
+  } else {\r
+    ProtocolType = TxData->ProtocolType;\r
+  }\r
 \r
   for (;;) {\r
     //\r
 \r
   for (;;) {\r
     //\r