]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
Fix “reconnect -r” ASSERT after VLAN configured.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpIo.c
index b8f61bf696fe1d82e45b9122202e18ee59da1d67..7f03b848ef396fda0f75b0cbe8149340f669092d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of Managed Network Protocol I/O functions.\r
 \r
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2014, 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
@@ -128,16 +128,13 @@ MnpBuildTxPacket (
   MNP_DEVICE_DATA         *MnpDerviceData;\r
 \r
   MnpDerviceData = MnpServiceData->MnpDeviceData;\r
+\r
+  //\r
+  // Reserve space for vlan tag.\r
+  //\r
+  *PktBuf = MnpDerviceData->TxBuf + NET_VLAN_TAG_LEN;\r
+  \r
   if ((TxData->DestinationAddress == NULL) && (TxData->FragmentCount == 1)) {\r
-    //\r
-    // Reserve space for vlan tag,if necessary.\r
-    //\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
@@ -151,9 +148,8 @@ MnpBuildTxPacket (
     // one fragment, copy the data into the packet buffer. Reserve the\r
     // media header space if necessary.\r
     //\r
-    SnpMode = MnpDerviceData->Snp->Mode;\r
-    DstPos  = MnpDerviceData->TxBuf;\r
-\r
+    SnpMode = MnpDerviceData->Snp->Mode; \r
+    DstPos  = *PktBuf;\r
     *PktLen = 0;\r
     if (TxData->DestinationAddress != NULL) {\r
       //\r
@@ -177,9 +173,8 @@ MnpBuildTxPacket (
     }\r
 \r
     //\r
-    // Set the buffer pointer and the buffer length.\r
+    // Set the buffer length.\r
     //\r
-    *PktBuf = MnpDerviceData->TxBuf;\r
     *PktLen += TxData->DataLength + TxData->HeaderLength;\r
   }\r
 }\r