/* Search VLAN device path node in Device Path of specified ServiceHandle and return its VLAN ID. If no VLAN device path node found, then this ServiceHandle is not a VLAN device handle, and 0 will be returned. */
UINT16 EFIAPI NetLibGetVlanId(IN EFI_HANDLE ServiceHandle)
/* Search VLAN device path node in Device Path of specified ServiceHandle and return its VLAN ID. If no VLAN device path node found, then this ServiceHandle is not a VLAN device handle, and 0 will be returned. */
UINT16 EFIAPI NetLibGetVlanId(IN EFI_HANDLE ServiceHandle)
{
  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
  EFI_DEVICE_PATH_PROTOCOL  *Node;
  DevicePath = DevicePathFromHandle (ServiceHandle);
  if (DevicePath == NULL) {
    return 0;
  }
  Node = DevicePath;
  while (!IsDevicePathEnd (Node)) {
    if ((Node->Type == MESSAGING_DEVICE_PATH) && (Node->SubType == MSG_VLAN_DP)) {
      return ((VLAN_DEVICE_PATH *)Node)->VlanId;
    }
    Node = NextDevicePathNode (Node);
  }
  return 0;
}