summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Jiaxin <jiaxin.wu@intel.com>2013-12-23 08:43:09 +0000
committerjiaxinwu <jiaxinwu@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-23 08:43:09 +0000
commitbdebd2cecf015a5feb11e99269731cac606167e8 (patch)
tree47a53c16f25d8684ab23b0c9dcb1f71a6c5fa491
parentda660118bd391d1f421f99921f9f15a66a8fc7ea (diff)
downloadedk2-platforms-bdebd2cecf015a5feb11e99269731cac606167e8.tar.xz
Fix a bug for vlan ping failure.
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
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c31
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c9
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h4
3 files changed, 27 insertions, 17 deletions
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
index 1aa3207ea3..b8f61bf696 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
@@ -1,7 +1,7 @@
/** @file
Implementation of Managed Network Protocol I/O functions.
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, 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 which accompanies this distribution. The full
@@ -130,10 +130,20 @@ MnpBuildTxPacket (
MnpDerviceData = MnpServiceData->MnpDeviceData;
if ((TxData->DestinationAddress == NULL) && (TxData->FragmentCount == 1)) {
//
- // Media header is in FragmentTable and there is only one fragment,
- // use fragment buffer directly.
+ // Reserve space for vlan tag,if necessary.
//
- *PktBuf = TxData->FragmentTable[0].FragmentBuffer;
+ if (MnpServiceData->VlanId != 0) {
+ *PktBuf = MnpDerviceData->TxBuf + NET_VLAN_TAG_LEN;
+ } else {
+ *PktBuf = MnpDerviceData->TxBuf;
+ }
+
+ CopyMem (
+ *PktBuf,
+ TxData->FragmentTable[0].FragmentBuffer,
+ TxData->FragmentTable[0].FragmentLength
+ );
+
*PktLen = TxData->FragmentTable[0].FragmentLength;
} else {
//
@@ -235,10 +245,15 @@ MnpSyncSendPacket (
goto SIGNAL_TOKEN;
}
- //
- // Insert VLAN tag
- //
- MnpInsertVlanTag (MnpServiceData, TxData, &ProtocolType, &Packet, &Length);
+
+ if (MnpServiceData->VlanId != 0) {
+ //
+ // Insert VLAN tag
+ //
+ MnpInsertVlanTag (MnpServiceData, TxData, &ProtocolType, &Packet, &Length);
+ } else {
+ ProtocolType = TxData->ProtocolType;
+ }
for (;;) {
//
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c
index 850ed51622..aa7da980d9 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.c
@@ -1,7 +1,7 @@
/** @file
VLAN Config Protocol implementation and VLAN packet process routine.
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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 which accompanies this distribution. The full
@@ -171,7 +171,7 @@ MnpRemoveVlanTag (
/**
- Build the packet to transmit from the TxData passed in.
+ Build the vlan packet to transmit from the TxData passed in.
@param MnpServiceData Pointer to the mnp service context data.
@param TxData Pointer to the transmit data containing the
@@ -197,11 +197,6 @@ MnpInsertVlanTag (
MNP_DEVICE_DATA *MnpDeviceData;
EFI_SIMPLE_NETWORK_MODE *SnpMode;
- if (MnpServiceData->VlanId == 0) {
- *ProtocolType = TxData->ProtocolType;
- return ;
- }
-
MnpDeviceData = MnpServiceData->MnpDeviceData;
SnpMode = MnpDeviceData->Snp->Mode;
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h b/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h
index 70b6cec260..d8eac8d07a 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpVlan.h
@@ -1,7 +1,7 @@
/** @file
Header file to be included by MnpVlan.c.
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, 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 which accompanies this distribution. The full
@@ -59,7 +59,7 @@ MnpRemoveVlanTag (
);
/**
- Build the packet to transmit from the TxData passed in.
+ Build the vlan packet to transmit from the TxData passed in.
@param MnpServiceData Pointer to the mnp service context data.
@param TxData Pointer to the transmit data containing the