/** @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
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
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
\r
VlanId = 0;\r
- IsVlanPacket = MnpRemoveVlanTag (MnpDeviceData, Nbuf, &VlanId);\r
+ if (MnpDeviceData->NumberOfVlan != 0) {\r
+ //\r
+ // VLAN is configured, remove the VLAN tag if any\r
+ //\r
+ IsVlanPacket = MnpRemoveVlanTag (MnpDeviceData, Nbuf, &VlanId);\r
+ } else {\r
+ IsVlanPacket = FALSE;\r
+ }\r
\r
MnpServiceData = MnpFindServiceData (MnpDeviceData, VlanId);\r
if (MnpServiceData == NULL) {\r