]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix a bug for vlan ping failure.
authorWu Jiaxin <jiaxin.wu@intel.com>
Mon, 23 Dec 2013 08:43:09 +0000 (08:43 +0000)
committerjiaxinwu <jiaxinwu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Dec 2013 08:43:09 +0000 (08:43 +0000)
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com >
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jin Eric <eric.jin@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15017 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c
MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h

index 1aa3207ea357d2d4ba6705e9d4c4e086ee7ca894..b8f61bf696fe1d82e45b9122202e18ee59da1d67 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -130,10 +130,20 @@ MnpBuildTxPacket (
   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
-    *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
@@ -235,10 +245,15 @@ MnpSyncSendPacket (
     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
index 850ed51622f04b2f56357d6141e32cc12eebf7a5..aa7da980d982b32189b4c319685f57f9898111ad 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   VLAN Config Protocol implementation and VLAN packet process routine.\r
 \r
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 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
@@ -171,7 +171,7 @@ MnpRemoveVlanTag (
 \r
 \r
 /**\r
-  Build the packet to transmit from the TxData passed in.\r
+  Build the vlan packet to transmit from the TxData passed in.\r
 \r
   @param  MnpServiceData         Pointer to the mnp service context data.\r
   @param  TxData                 Pointer to the transmit data containing the\r
@@ -197,11 +197,6 @@ MnpInsertVlanTag (
   MNP_DEVICE_DATA         *MnpDeviceData;\r
   EFI_SIMPLE_NETWORK_MODE *SnpMode;\r
 \r
-  if (MnpServiceData->VlanId == 0) {\r
-    *ProtocolType = TxData->ProtocolType;\r
-    return ;\r
-  }\r
-\r
   MnpDeviceData = MnpServiceData->MnpDeviceData;\r
   SnpMode       = MnpDeviceData->Snp->Mode;\r
 \r
index 70b6cec260c187ecdc2db7a859377edcca92265c..d8eac8d07ac833d0f2dbae91ae8cd2f0f006da2a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file to be included by MnpVlan.c.\r
 \r
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 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
@@ -59,7 +59,7 @@ MnpRemoveVlanTag (
   );\r
 \r
 /**\r
-  Build the packet to transmit from the TxData passed in.\r
+  Build the vlan packet to transmit from the TxData passed in.\r
 \r
   @param  MnpServiceData         Pointer to the mnp service context data.\r
   @param  TxData                 Pointer to the transmit data containing the\r