+ //\r
+ // Get current VLAN configuration from EFI Variable\r
+ //\r
+ NumberOfVlan = 0;\r
+ Status = MnpGetVlanVariable (MnpDeviceData, &NumberOfVlan, &VlanVariable);\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // No VLAN is set, create a default MNP service data for untagged frame\r
+ //\r
+ MnpDeviceData->NumberOfVlan = 0;\r
+ MnpServiceData = MnpCreateServiceData (MnpDeviceData, 0, 0);\r
+ Status = (MnpServiceData != NULL) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES;\r
+ goto Exit;\r
+ }\r
+\r
+ //\r
+ // Create MNP service data for each VLAN\r
+ //\r
+ MnpDeviceData->NumberOfVlan = NumberOfVlan;\r
+ for (Index = 0; Index < NumberOfVlan; Index++) {\r
+ MnpServiceData = MnpCreateServiceData (\r
+ MnpDeviceData,\r
+ VlanVariable[Index].Bits.Vid,\r
+ (UINT8) VlanVariable[Index].Bits.Priority\r
+ );\r
+\r
+ if (MnpServiceData == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+\r
+ goto Exit;\r
+ }\r
+ }\r
+\r
+Exit:\r
+ if (VlanVariable != NULL) {\r
+ FreePool (VlanVariable);\r
+ }\r