From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001
From: Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com>
Date: Tue, 10 Oct 2023 14:33:42 +0000
Subject: Add submodule dependency files

Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
---
 roms/edk2/NetworkPkg/Application/VConfig/VConfig.c | 689 +++++++++++++++++++++
 .../NetworkPkg/Application/VConfig/VConfig.inf     |  56 ++
 .../NetworkPkg/Application/VConfig/VConfig.uni     |  16 +
 .../Application/VConfig/VConfigExtra.uni           |  14 +
 .../Application/VConfig/VConfigStrings.uni         |  57 ++
 5 files changed, 832 insertions(+)
 create mode 100644 roms/edk2/NetworkPkg/Application/VConfig/VConfig.c
 create mode 100644 roms/edk2/NetworkPkg/Application/VConfig/VConfig.inf
 create mode 100644 roms/edk2/NetworkPkg/Application/VConfig/VConfig.uni
 create mode 100644 roms/edk2/NetworkPkg/Application/VConfig/VConfigExtra.uni
 create mode 100644 roms/edk2/NetworkPkg/Application/VConfig/VConfigStrings.uni

(limited to 'roms/edk2/NetworkPkg/Application')

diff --git a/roms/edk2/NetworkPkg/Application/VConfig/VConfig.c b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.c
new file mode 100644
index 000000000..b50b07b97
--- /dev/null
+++ b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.c
@@ -0,0 +1,689 @@
+/** @file
+  Shell application for VLAN configuration.
+
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+#include <Protocol/VlanConfig.h>
+
+#include <Library/UefiApplicationEntryPoint.h>
+#include <Library/UefiLib.h>
+#include <Library/ShellLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/HiiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiHiiServicesLib.h>
+#include <Library/NetLib.h>
+
+//
+// String token ID of VConfig command help message text.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringVConfigHelpTokenId = STRING_TOKEN (STR_VCONFIG_HELP);
+
+#define INVALID_NIC_INDEX   0xffff
+#define INVALID_VLAN_ID     0xffff
+
+//
+// This is the generated String package data for all .UNI files.
+// This data array is ready to be used as input of HiiAddPackages() to
+// create a packagelist (which contains Form packages, String packages, etc).
+//
+extern UINT8      VConfigStrings[];
+
+EFI_HANDLE        mImageHandle  = NULL;
+EFI_HII_HANDLE    mHiiHandle    = NULL;
+
+SHELL_PARAM_ITEM  mParamList[] = {
+  {
+    L"-l",
+    TypeValue
+  },
+  {
+    L"-a",
+    TypeMaxValue
+  },
+  {
+    L"-d",
+    TypeValue
+  },
+  {
+    NULL,
+    TypeMax
+  }
+};
+
+/**
+  Locate the network interface handle buffer.
+
+  @param[out]  NumberOfHandles Pointer to the number of handles.
+  @param[out]  HandleBuffer    Pointer to the buffer to store the returned handles.
+
+**/
+VOID
+LocateNicHandleBuffer (
+  OUT UINTN                       *NumberOfHandles,
+  OUT EFI_HANDLE                  **HandleBuffer
+  )
+{
+  EFI_STATUS  Status;
+
+  *NumberOfHandles  = 0;
+  *HandleBuffer     = NULL;
+
+  Status = gBS->LocateHandleBuffer (
+                  ByProtocol,
+                  &gEfiVlanConfigProtocolGuid,
+                  NULL,
+                  NumberOfHandles,
+                  HandleBuffer
+                  );
+  if (EFI_ERROR (Status)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_LOCATE_FAIL), mHiiHandle, Status);
+  }
+}
+
+/**
+  Extract the decimal index from the network interface name.
+
+  @param[in]  Name           Name of the network interface.
+
+  @retval INVALID_NIC_INDEX  Failed to extract the network interface index.
+  @return others             The network interface index.
+
+**/
+UINTN
+NicNameToIndex (
+  IN CHAR16                   *Name
+  )
+{
+  CHAR16  *Str;
+
+  Str = Name + 3;
+  if ((StrnCmp (Name, L"eth", 3) != 0) || (*Str == 0)) {
+    return INVALID_NIC_INDEX;
+  }
+
+  while (*Str != 0) {
+    if ((*Str < L'0') || (*Str > L'9')) {
+      return INVALID_NIC_INDEX;
+    }
+
+    Str++;
+  }
+
+  return (UINT16) StrDecimalToUintn (Name + 3);
+}
+
+/**
+  Find network interface device handle by its name.
+
+  @param[in]  Name           Name of the network interface.
+
+  @retval NULL               Cannot find the network interface.
+  @return others             Handle of the network interface.
+
+**/
+EFI_HANDLE
+NicNameToHandle (
+  IN CHAR16                   *Name
+  )
+{
+  UINTN       NumberOfHandles;
+  EFI_HANDLE  *HandleBuffer;
+  UINTN       Index;
+  EFI_HANDLE  Handle;
+
+  //
+  // Find all NIC handles.
+  //
+  LocateNicHandleBuffer (&NumberOfHandles, &HandleBuffer);
+  if (NumberOfHandles == 0) {
+    return NULL;
+  }
+
+  Index = NicNameToIndex (Name);
+  if (Index >= NumberOfHandles) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_INVALID_IF), mHiiHandle, Name);
+    Handle = NULL;
+  } else {
+    Handle = HandleBuffer[Index];
+  }
+
+  FreePool (HandleBuffer);
+  return Handle;
+}
+
+/**
+  Open VlanConfig protocol from a handle.
+
+  @param[in]  Handle         The handle to open the VlanConfig protocol.
+
+  @return The VlanConfig protocol interface.
+
+**/
+EFI_VLAN_CONFIG_PROTOCOL *
+OpenVlanConfigProtocol (
+  IN EFI_HANDLE                 Handle
+  )
+{
+  EFI_VLAN_CONFIG_PROTOCOL  *VlanConfig;
+
+  VlanConfig = NULL;
+  gBS->OpenProtocol (
+         Handle,
+         &gEfiVlanConfigProtocolGuid,
+         (VOID **) &VlanConfig,
+         mImageHandle,
+         Handle,
+         EFI_OPEN_PROTOCOL_GET_PROTOCOL
+         );
+
+  return VlanConfig;
+}
+
+/**
+  Close VlanConfig protocol of a handle.
+
+  @param[in]  Handle         The handle to close the VlanConfig protocol.
+
+**/
+VOID
+CloseVlanConfigProtocol (
+  IN EFI_HANDLE                 Handle
+  )
+{
+  gBS->CloseProtocol (
+         Handle,
+         &gEfiVlanConfigProtocolGuid,
+         mImageHandle,
+         Handle
+         );
+}
+
+/**
+  Display VLAN configuration of a network interface.
+
+  @param[in]  Handle         Handle of the network interface.
+  @param[in]  NicIndex       Index of the network interface.
+
+**/
+VOID
+ShowNicVlanInfo (
+  IN EFI_HANDLE              Handle,
+  IN UINTN                   NicIndex
+  )
+{
+  CHAR16                    *MacStr;
+  EFI_STATUS                Status;
+  UINTN                     Index;
+  EFI_VLAN_CONFIG_PROTOCOL  *VlanConfig;
+  UINT16                    NumberOfVlan;
+  EFI_VLAN_FIND_DATA        *VlanData;
+
+  VlanConfig = OpenVlanConfigProtocol (Handle);
+  if (VlanConfig == NULL) {
+    return ;
+  }
+
+  MacStr  = NULL;
+  Status  = NetLibGetMacString (Handle, mImageHandle, &MacStr);
+  if (EFI_ERROR (Status)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_MAC_FAIL), mHiiHandle, Status);
+    goto Exit;
+  }
+
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_ETH_MAC), mHiiHandle, NicIndex, MacStr);
+
+  Status = VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);
+  if (EFI_ERROR (Status)) {
+    if (Status == EFI_NOT_FOUND) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VLAN), mHiiHandle);
+    } else {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_FIND_FAIL), mHiiHandle, Status);
+    }
+
+    goto Exit;
+  }
+
+  for (Index = 0; Index < NumberOfVlan; Index++) {
+    ShellPrintHiiEx (
+      -1,
+      -1,
+      NULL,
+      STRING_TOKEN (STR_VCONFIG_VLAN_DISPLAY),
+      mHiiHandle,
+      VlanData[Index].VlanId,
+      VlanData[Index].Priority
+      );
+  }
+
+  FreePool (VlanData);
+
+Exit:
+  CloseVlanConfigProtocol (Handle);
+
+  if (MacStr != NULL) {
+    FreePool (MacStr);
+  }
+}
+
+/**
+  Display the VLAN configuration of all, or a specified network interface.
+
+  @param[in]  Name           Name of the network interface. If NULL, the VLAN
+                             configuration of all network will be displayed.
+
+**/
+VOID
+DisplayVlan (
+  IN CHAR16              *Name OPTIONAL
+  )
+{
+  UINTN       NumberOfHandles;
+  EFI_HANDLE  *HandleBuffer;
+  UINTN       Index;
+  EFI_HANDLE  NicHandle;
+
+  if (Name != NULL) {
+    //
+    // Display specified NIC
+    //
+    NicHandle = NicNameToHandle (Name);
+    if (NicHandle == NULL) {
+      return ;
+    }
+
+    ShowNicVlanInfo (NicHandle, 0);
+    return ;
+  }
+
+  //
+  // Find all NIC handles
+  //
+  LocateNicHandleBuffer (&NumberOfHandles, &HandleBuffer);
+  if (NumberOfHandles == 0) {
+    return ;
+  }
+
+  for (Index = 0; Index < NumberOfHandles; Index++) {
+    ShowNicVlanInfo (HandleBuffer[Index], Index);
+  }
+
+  FreePool (HandleBuffer);
+}
+
+/**
+  Convert a NULL-terminated unicode decimal VLAN ID string to VLAN ID.
+
+  @param[in]  String       Pointer to VLAN ID string from user input.
+
+  @retval Value translated from String, or INVALID_VLAN_ID is string is invalid.
+
+**/
+UINT16
+StrToVlanId (
+  IN CHAR16             *String
+  )
+{
+  CHAR16  *Str;
+
+  if (String == NULL) {
+    return INVALID_VLAN_ID;
+  }
+
+  Str = String;
+  while ((*Str >= '0') && (*Str <= '9')) {
+    Str++;
+  }
+
+  if (*Str != 0) {
+    return INVALID_VLAN_ID;
+  }
+
+  return (UINT16) StrDecimalToUintn (String);
+}
+
+/**
+  Add a VLAN device.
+
+  @param[in]  ParamStr       Parameter string from user input.
+
+**/
+VOID
+AddVlan (
+  IN CHAR16             *ParamStr
+  )
+{
+  CHAR16                    *Name;
+  CHAR16                    *VlanIdStr;
+  CHAR16                    *PriorityStr;
+  CHAR16                    *StrPtr;
+  BOOLEAN                   IsSpace;
+  UINTN                     VlanId;
+  UINTN                     Priority;
+  EFI_HANDLE                Handle;
+  EFI_HANDLE                VlanHandle;
+  EFI_VLAN_CONFIG_PROTOCOL  *VlanConfig;
+  EFI_STATUS                Status;
+
+  VlanConfig  = NULL;
+  Priority    = 0;
+
+  if (ParamStr == NULL) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_IF), mHiiHandle);
+    return ;
+  }
+
+  StrPtr = AllocateCopyPool (StrSize (ParamStr), ParamStr);
+  if (StrPtr == NULL) {
+    return ;
+  }
+
+  Name        = StrPtr;
+  VlanIdStr   = NULL;
+  PriorityStr = NULL;
+  IsSpace     = FALSE;
+  while (*StrPtr != 0) {
+    if (*StrPtr == L' ') {
+      *StrPtr = 0;
+      IsSpace = TRUE;
+    } else {
+      if (IsSpace) {
+        //
+        // Start of a parameter.
+        //
+        if (VlanIdStr == NULL) {
+          //
+          // 2nd parameter is VLAN ID.
+          //
+          VlanIdStr = StrPtr;
+        } else if (PriorityStr == NULL) {
+          //
+          // 3rd parameter is Priority.
+          //
+          PriorityStr = StrPtr;
+        } else {
+          //
+          // Ignore else parameters.
+          //
+          break;
+        }
+      }
+
+      IsSpace = FALSE;
+    }
+
+    StrPtr++;
+  }
+
+  Handle = NicNameToHandle (Name);
+  if (Handle == NULL) {
+    goto Exit;
+  }
+
+  VlanConfig = OpenVlanConfigProtocol (Handle);
+  if (VlanConfig == NULL) {
+    goto Exit;
+  }
+
+  //
+  // Check VLAN ID.
+  //
+  if ((VlanIdStr == NULL) || (*VlanIdStr == 0)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VID), mHiiHandle);
+    goto Exit;
+  }
+
+  VlanId = StrToVlanId (VlanIdStr);
+  if (VlanId > 4094) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_INVALID_VID), mHiiHandle, VlanIdStr);
+    goto Exit;
+  }
+
+  //
+  // Check Priority.
+  //
+  if ((PriorityStr != NULL) && (*PriorityStr != 0)) {
+    Priority = StrDecimalToUintn (PriorityStr);
+    if (Priority > 7) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_INVALID_PRIORITY), mHiiHandle, PriorityStr);
+      goto Exit;
+    }
+  }
+
+  //
+  // Set VLAN
+  //
+  Status = VlanConfig->Set (VlanConfig, (UINT16) VlanId, (UINT8) Priority);
+  if (EFI_ERROR (Status)) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_SET_FAIL), mHiiHandle, Status);
+    goto Exit;
+  }
+
+  //
+  // Connect the VLAN device.
+  //
+  VlanHandle = NetLibGetVlanHandle (Handle, (UINT16) VlanId);
+  if (VlanHandle != NULL) {
+    gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);
+  }
+
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_SET_SUCCESS), mHiiHandle);
+
+Exit:
+  if (VlanConfig != NULL) {
+    CloseVlanConfigProtocol (Handle);
+  }
+
+  FreePool (Name);
+}
+
+/**
+  Remove a VLAN device.
+
+  @param[in]  ParamStr       Parameter string from user input.
+
+**/
+VOID
+DeleteVlan (
+  IN CHAR16 *ParamStr
+  )
+{
+  CHAR16                    *Name;
+  CHAR16                    *VlanIdStr;
+  CHAR16                    *StrPtr;
+  UINTN                     VlanId;
+  EFI_HANDLE                Handle;
+  EFI_VLAN_CONFIG_PROTOCOL  *VlanConfig;
+  EFI_STATUS                Status;
+  UINT16                    NumberOfVlan;
+  EFI_VLAN_FIND_DATA        *VlanData;
+
+  VlanConfig = NULL;
+
+  if (ParamStr == NULL) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_IF), mHiiHandle);
+    return ;
+  }
+
+  StrPtr = AllocateCopyPool (StrSize (ParamStr), ParamStr);
+  if (StrPtr == NULL) {
+    return ;
+  }
+
+  Name      = StrPtr;
+  VlanIdStr = NULL;
+  while (*StrPtr != 0) {
+    if (*StrPtr == L'.') {
+      *StrPtr   = 0;
+      VlanIdStr = StrPtr + 1;
+      break;
+    }
+
+    StrPtr++;
+  }
+
+  Handle = NicNameToHandle (Name);
+  if (Handle == NULL) {
+    goto Exit;
+  }
+
+  VlanConfig = OpenVlanConfigProtocol (Handle);
+  if (VlanConfig == NULL) {
+    goto Exit;
+  }
+
+  //
+  // Check VLAN ID
+  //
+  if (VlanIdStr == NULL || *VlanIdStr == 0) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VID), mHiiHandle);
+    goto Exit;
+  }
+
+  VlanId = StrToVlanId (VlanIdStr);
+  if (VlanId > 4094) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_INVALID_VID), mHiiHandle, VlanIdStr);
+    goto Exit;
+  }
+
+  //
+  // Delete VLAN.
+  //
+  Status = VlanConfig->Remove (VlanConfig, (UINT16) VlanId);
+  if (EFI_ERROR (Status)) {
+    if (Status == EFI_NOT_FOUND) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NOT_FOUND), mHiiHandle);
+    } else {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_REMOVE_FAIL), mHiiHandle, Status);
+    }
+
+    goto Exit;
+  }
+
+  //
+  // Check whether this is the last VLAN to remove.
+  //
+  Status = VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);
+  if (EFI_ERROR (Status)) {
+    //
+    // This is the last VLAN to remove, try to connect the controller handle.
+    //
+    gBS->ConnectController (Handle, NULL, NULL, TRUE);
+  } else {
+    FreePool (VlanData);
+  }
+
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_REMOVE_SUCCESS), mHiiHandle);
+
+Exit:
+  if (VlanConfig != NULL) {
+    CloseVlanConfigProtocol (Handle);
+  }
+
+  FreePool (Name);
+}
+
+/**
+  The actual entry point for the application.
+
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
+  @param[in] SystemTable    A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS       The entry point executed successfully.
+  @retval other             Some error occur when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+VlanConfigMain (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  LIST_ENTRY    *List;
+  CONST CHAR16  *Str;
+  EFI_HII_PACKAGE_LIST_HEADER     *PackageList;
+  EFI_STATUS    Status;
+
+  mImageHandle = ImageHandle;
+
+  //
+  // Retrieve HII package list from ImageHandle
+  //
+  Status = gBS->OpenProtocol (
+                  ImageHandle,
+                  &gEfiHiiPackageListProtocolGuid,
+                  (VOID **) &PackageList,
+                  ImageHandle,
+                  NULL,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Publish HII package list to HII Database.
+  //
+  Status = gHiiDatabase->NewPackageList (
+                          gHiiDatabase,
+                          PackageList,
+                          NULL,
+                          &mHiiHandle
+                          );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  if (mHiiHandle == NULL) {
+    return EFI_SUCCESS;
+  }
+
+  List = NULL;
+  ShellCommandLineParseEx (mParamList, &List, NULL, FALSE, FALSE);
+  if (List == NULL) {
+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_ARG), mHiiHandle);
+    goto Exit;
+  }
+
+  if (ShellCommandLineGetFlag (List, L"-l")) {
+    Str = ShellCommandLineGetValue (List, L"-l");
+    DisplayVlan ((CHAR16 *) Str);
+    goto Exit;
+  }
+
+  if (ShellCommandLineGetFlag (List, L"-a")) {
+    Str = ShellCommandLineGetValue (List, L"-a");
+    AddVlan ((CHAR16 *) Str);
+    goto Exit;
+  }
+
+  if (ShellCommandLineGetFlag (List, L"-d")) {
+    Str = ShellCommandLineGetValue (List, L"-d");
+    DeleteVlan ((CHAR16 *) Str);
+    goto Exit;
+  }
+
+  //
+  // No valid argument till now.
+  //
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_ARG), mHiiHandle);
+
+Exit:
+  if (List != NULL) {
+    ShellCommandLineFreeVarList (List);
+  }
+
+  //
+  // Remove our string package from HII database.
+  //
+  HiiRemovePackages (mHiiHandle);
+
+  return EFI_SUCCESS;
+}
diff --git a/roms/edk2/NetworkPkg/Application/VConfig/VConfig.inf b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.inf
new file mode 100644
index 000000000..1d7a81201
--- /dev/null
+++ b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.inf
@@ -0,0 +1,56 @@
+## @file
+#  Shell application VLAN configuration.
+#
+#  It is shell application which is used to get and set VLAN configuration.
+#
+#  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = VConfig
+  FILE_GUID                      = 87E36301-0406-44db-AAF3-9E0E591F3725
+  MODULE_TYPE                    = UEFI_APPLICATION
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = VlanConfigMain
+  MODULE_UNI_FILE                = VConfig.uni
+
+#
+#
+#  This flag specifies whether HII resource section is generated into PE image.
+#
+  UEFI_HII_RESOURCE_SECTION      = TRUE
+
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  VConfigStrings.uni
+  VConfig.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  NetworkPkg/NetworkPkg.dec
+  ShellPkg/ShellPkg.dec
+
+[LibraryClasses]
+  UefiApplicationEntryPoint
+  UefiBootServicesTableLib
+  UefiHiiServicesLib
+  UefiLib
+  ShellLib
+  NetLib
+  MemoryAllocationLib
+  HiiLib
+
+[Protocols]
+  gEfiVlanConfigProtocolGuid       ## CONSUMES
+  gEfiHiiPackageListProtocolGuid   ## CONSUMES
+
+[UserExtensions.TianoCore."ExtraFiles"]
+  VConfigExtra.uni
diff --git a/roms/edk2/NetworkPkg/Application/VConfig/VConfig.uni b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.uni
new file mode 100644
index 000000000..41511e644
--- /dev/null
+++ b/roms/edk2/NetworkPkg/Application/VConfig/VConfig.uni
@@ -0,0 +1,16 @@
+// /** @file
+// Shell application VLAN configuration.
+//
+// It is shell application which is used to get and set VLAN configuration.
+//
+// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT             #language en-US "Shell application VLAN configuration"
+
+#string STR_MODULE_DESCRIPTION          #language en-US "It is shell application which is used to get and set VLAN configuration."
+
diff --git a/roms/edk2/NetworkPkg/Application/VConfig/VConfigExtra.uni b/roms/edk2/NetworkPkg/Application/VConfig/VConfigExtra.uni
new file mode 100644
index 000000000..1177ae3c9
--- /dev/null
+++ b/roms/edk2/NetworkPkg/Application/VConfig/VConfigExtra.uni
@@ -0,0 +1,14 @@
+// /** @file
+// VConfig Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Vlan Config App"
+
+
diff --git a/roms/edk2/NetworkPkg/Application/VConfig/VConfigStrings.uni b/roms/edk2/NetworkPkg/Application/VConfig/VConfigStrings.uni
new file mode 100644
index 000000000..9caf409f1
--- /dev/null
+++ b/roms/edk2/NetworkPkg/Application/VConfig/VConfigStrings.uni
@@ -0,0 +1,57 @@
+/** @file
+  String definitions for VLAN configuration Shell application.
+
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#langdef en-US "English"
+
+#string STR_VCONFIG_LOCATE_FAIL          #language en-US    "Failed to locate EFI_VLAN_CONFIG_PROTOCOL - %r.\n"
+#string STR_VCONFIG_MAC_FAIL             #language en-US    "Failed to get MAC address - %r.\n"
+#string STR_VCONFIG_FIND_FAIL            #language en-US    "Failed to find VLAN configuration - %r.\n"
+#string STR_VCONFIG_SET_FAIL             #language en-US    "Failed to set VLAN configuration - %r.\n"
+#string STR_VCONFIG_REMOVE_FAIL          #language en-US    "Failed to remove VLAN - %r.\n"
+#string STR_VCONFIG_NO_IF                #language en-US    "Network interface not specified.\n"
+#string STR_VCONFIG_NO_VID               #language en-US    "VLAN ID not specified.\n"
+#string STR_VCONFIG_INVALID_IF           #language en-US    "Invalid network interface - %s.\n"
+#string STR_VCONFIG_INVALID_VID          #language en-US    "Invalid VLAN ID - %s.\n"
+#string STR_VCONFIG_INVALID_PRIORITY     #language en-US    "Invalid VLAN Priority - %s.\n"
+#string STR_VCONFIG_NOT_FOUND            #language en-US    "Cannot find the VLAN device specified.\n"
+#string STR_VCONFIG_VLAN_DISPLAY         #language en-US    "    VLAN ID: %4d  Priority: %d\n"
+#string STR_VCONFIG_NO_VLAN              #language en-US    "    VLAN is not configured.\n"
+#string STR_VCONFIG_ETH_MAC              #language en-US    "eth%d  MAC:%s\n"
+#string STR_VCONFIG_SET_SUCCESS          #language en-US    "VLAN device added.\n"
+#string STR_VCONFIG_REMOVE_SUCCESS       #language en-US    "VLAN device removed.\n"
+#string STR_VCONFIG_NO_ARG               #language en-US    "Invalid argument, try "-?" for help.\n"
+
+#string STR_VCONFIG_HELP                 #language en-US    ""
+".TH VConfig 0 "Display or modify VLAN configuration for network interface."\r\n"
+".SH NAME\r\n"
+"Display or modify VLAN configuration for network interface.\r\n"
+".SH SYNOPSIS\r\n"
+" \r\n"
+"VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\r\n"
+".SH OPTIONS\r\n"
+" \r\n"
+"  -l          Display VLAN configuration for all or specified interface.\r\n"
+"  -a          Add a VLAN device for the network interface.\r\n"
+"  -d          Delete a VLAN device.\r\n"
+"  IfName      Name of network interface, e.g. eth0, eth1.\r\n"
+"  VlanId      Unique VLAN identifier (0~4094).\r\n"
+"  Priority    802.1Q priority level (0~7), default 0.\r\n"
+".SH EXAMPLES\r\n"
+" \r\n"
+"Examples:\r\n"
+"  * To display VLAN configuration:\r\n"
+"    fs0:\> vconfig -l\r\n"
+"    fs0:\> vconfig -l eth0\r\n"
+"\r\n"
+"  * To add VLAN device:\r\n"
+"    fs0:\> vconfig -a eth0 1000\r\n"
+"    fs0:\> vconfig -a eth0 2000 7\r\n"
+"\r\n"
+"  * To delete VLAN device:\r\n"
+"    fs0:\> vconfig -d eth0.1000\r\n"
-- 
cgit