public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
@ 2018-11-22  5:21 Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
                   ` (7 more replies)
  0 siblings, 8 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel
  Cc: Jiaxin Wu, Ting Ye, Ruiyu Ni, Hao Wu, Laszlo Ersek,
	Ard Biesheuvel, Julien Grall, Jordan Justen, Andrew Fish,
	Anthony Perard, David Wei, Mang Guo

There is a patch to remove the redudant IP4 only iSCSI/PXE/TCP drivers
from MdeModulePkg, which has been reviewed before edk2-stable201811 tag.
And we also have plan to move all network related libraries/modules to
NetworkPkg. In order to make these change more smoothly, a set of fragment
files (2 for DSC and 1 for FDF) are provided for platform to enable the 
network stack support, without directly reference the INF module path.

Patch 1/6 adds centralized dsc/fdf include files to NetworkPkg, with
a set of flags for feature set enable/disable.
Patch 2~6 updates edk2 platform dsc/fdf files to use the new include
files, instead of reference the module INF.

v2:
  1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
  file. This could provide more flexibility to platform owner to use the
  include files.
  2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
  3. Use "!error" statement for incorrect flag value check.
  4. Update platform DSC/FDF to use the new include files.
  5. Other decoration work according to Laszlo's comments.



Fu Siyuan (6):
  NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  EmulatorPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  Vlv2TbltDevicePkg: Update DSC/FDF to use NetworkPkg's include fragment
    file.

 ArmVirtPkg/ArmVirt.dsc.inc              |  11 +-
 ArmVirtPkg/ArmVirtQemu.dsc              |  46 ++-----
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc    |  28 +---
 ArmVirtPkg/ArmVirtQemuKernel.dsc        |  46 ++-----
 EmulatorPkg/EmulatorPkg.dsc             |  39 ++++--
 EmulatorPkg/EmulatorPkg.fdf             |  10 +-
 NetworkPkg/Network.fdf.inc              |  69 ++++++++++
 NetworkPkg/NetworkComponents.dsc.inc    |  71 ++++++++++
 NetworkPkg/NetworkDefines.dsc.inc       | 138 ++++++++++++++++++++
 NetworkPkg/NetworkLibs.dsc.inc          |  25 ++++
 NetworkPkg/NetworkPcds.dsc.inc          |  22 ++++
 NetworkPkg/NetworkPkg.dsc               |  28 +---
 Nt32Pkg/Nt32Pkg.dsc                     | 104 ++++-----------
 Nt32Pkg/Nt32Pkg.fdf                     |  27 +---
 OvmfPkg/OvmfPkgIa32.dsc                 |  75 +++++------
 OvmfPkg/OvmfPkgIa32.fdf                 |  27 +---
 OvmfPkg/OvmfPkgIa32X64.dsc              |  76 +++++------
 OvmfPkg/OvmfPkgIa32X64.fdf              |  27 +---
 OvmfPkg/OvmfPkgX64.dsc                  |  75 +++++------
 OvmfPkg/OvmfPkgX64.fdf                  |  27 +---
 Vlv2TbltDevicePkg/PlatformPkg.fdf       |  25 +---
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  11 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    |  25 +---
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc |  52 +++-----
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |  52 +++-----
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc    |  52 +++-----
 26 files changed, 573 insertions(+), 615 deletions(-)
 create mode 100644 NetworkPkg/Network.fdf.inc
 create mode 100644 NetworkPkg/NetworkComponents.dsc.inc
 create mode 100644 NetworkPkg/NetworkDefines.dsc.inc
 create mode 100644 NetworkPkg/NetworkLibs.dsc.inc
 create mode 100644 NetworkPkg/NetworkPcds.dsc.inc

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>

-- 
2.19.1.windows.1



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-22  9:56   ` Ni, Ruiyu
  2018-11-23 10:56   ` Laszlo Ersek
  2018-11-22  5:21 ` [PATCH v2 2/6] Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file Fu Siyuan
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jiaxin Wu, Ting Ye

This patch provides a set of include segment files for platform owner to
easily enable/disable network stack support on their platform.

For DSC, there are:
- a "NetworkDefines.dsc.inc" for the [Defines] section(s),
- a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
- a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
- a "NetworkComponents.dsc.inc" for the [Components*] section(s).
For FDF, there is:
- a "Network.fdf.inc" for the [Fv*] section(s).

These files can be added to the platform DSC/FDF file by using
  !include NetworkPkg/xxx
where "xxx" is the *.inc file name.

A set of flags can be changed before the include line or in build command
line ("-D FLAG=VALUE") to enable or disable related feature set, please
check "NetworkDefines.dsc.inc" for a detail description of each flag.

The default value of these flags are:
  DEFINE NETWORK_ENABLE                 = TRUE
  DEFINE NETWORK_SNP_ENABLE             = TRUE
  DEFINE NETWORK_IP4_ENABLE             = TRUE
  DEFINE NETWORK_IP6_ENABLE             = TRUE
  DEFINE NETWORK_TLS_ENABLE             = TRUE
  DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
  DEFINE NETWORK_IPSEC_ENABLE           = TRUE
  DEFINE NETWORK_ISCSI_ENABLE           = TRUE
  DEFINE NETWORK_VLAN_ENABLE            = TRUE

Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---

Notes:
    v2:
    1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
    file. This could provide more flexibility to platform owner to use the
    include files.
    2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
    3. Use "!error" statement for incorrect flag value check.
    4. Other decoration work according to Laszlo's comments.

 NetworkPkg/Network.fdf.inc           |  69 ++++++++++
 NetworkPkg/NetworkComponents.dsc.inc |  71 ++++++++++
 NetworkPkg/NetworkDefines.dsc.inc    | 138 ++++++++++++++++++++
 NetworkPkg/NetworkLibs.dsc.inc       |  25 ++++
 NetworkPkg/NetworkPcds.dsc.inc       |  22 ++++
 NetworkPkg/NetworkPkg.dsc            |  28 +---
 6 files changed, 331 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc
new file mode 100644
index 000000000000..abd4c6c363d5
--- /dev/null
+++ b/NetworkPkg/Network.fdf.inc
@@ -0,0 +1,69 @@
+## @file
+# Network FDF include file for All Architectures.
+#
+# This file can be included to a platform FDF by using "!include NetworkPkg/Network.fdf.inc"
+# to add EDKII network stack drivers according to the value of flags described in
+# "NetworkDefines.dsc.inc".
+#
+# Copyright (c) 2018, 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 text of the license may be found at
+#    http://opensource.org/licenses/bsd-license.php
+#
+#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+!if $(NETWORK_ENABLE) == TRUE
+  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+
+  !if $(NETWORK_SNP_ENABLE) == TRUE
+    INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
+  !endif
+
+  !if $(NETWORK_VLAN_ENABLE) == TRUE
+    INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
+  !endif
+
+  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+
+  !if $(NETWORK_IP4_ENABLE) == TRUE
+    INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+    INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+    INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+    INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+    INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  !endif
+
+  !if $(NETWORK_IP6_ENABLE) == TRUE
+    INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
+    INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
+    INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
+    INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
+  !endif
+
+  INF  NetworkPkg/TcpDxe/TcpDxe.inf
+  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+
+  !if $(NETWORK_TLS_ENABLE) == TRUE
+    INF  NetworkPkg/TlsDxe/TlsDxe.inf
+    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
+  !endif
+
+  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
+    INF  NetworkPkg/DnsDxe/DnsDxe.inf
+    INF  NetworkPkg/HttpDxe/HttpDxe.inf
+    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
+    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+  !endif
+
+  !if $(NETWORK_ISCSI_ENABLE) == TRUE
+    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
+  !endif
+
+  !if $(NETWORK_IPSEC_ENABLE) == TRUE
+    INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
+  !endif
+!endif
diff --git a/NetworkPkg/NetworkComponents.dsc.inc b/NetworkPkg/NetworkComponents.dsc.inc
new file mode 100644
index 000000000000..8074489b8e06
--- /dev/null
+++ b/NetworkPkg/NetworkComponents.dsc.inc
@@ -0,0 +1,71 @@
+## @file
+# Network DSC include file for [Components*] section of all Architectures.
+#
+# This file can be included to the [Components*] section(s) of a platform DSC file
+# by using "!include NetworkPkg/NetworkComponents.dsc.inc" to specify the INF files
+# of EDKII network drivers according to the value of flags described in
+# "NetworkDefines.dsc.inc".
+#
+# Copyright (c) 2018, 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 text of the license may be found at
+#    http://opensource.org/licenses/bsd-license.php
+#
+#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+!if $(NETWORK_ENABLE) == TRUE
+  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+
+  !if $(NETWORK_SNP_ENABLE) == TRUE
+    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
+  !endif
+
+  !if $(NETWORK_VLAN_ENABLE) == TRUE
+    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
+  !endif
+
+  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+
+  !if $(NETWORK_IP4_ENABLE) == TRUE
+    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  !endif
+
+  !if $(NETWORK_IP6_ENABLE) == TRUE
+    NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
+    NetworkPkg/Ip6Dxe/Ip6Dxe.inf
+    NetworkPkg/Udp6Dxe/Udp6Dxe.inf
+    NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
+  !endif
+
+  NetworkPkg/TcpDxe/TcpDxe.inf
+  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+
+  !if $(NETWORK_TLS_ENABLE) == TRUE
+    NetworkPkg/TlsDxe/TlsDxe.inf
+    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
+  !endif
+
+  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
+    NetworkPkg/DnsDxe/DnsDxe.inf
+    NetworkPkg/HttpDxe/HttpDxe.inf
+    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
+    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+  !endif
+
+  !if $(NETWORK_ISCSI_ENABLE) == TRUE
+    NetworkPkg/IScsiDxe/IScsiDxe.inf
+  !endif
+
+  !if $(NETWORK_IPSEC_ENABLE) == TRUE
+    NetworkPkg/IpSecDxe/IpSecDxe.inf
+  !endif
+!endif
diff --git a/NetworkPkg/NetworkDefines.dsc.inc b/NetworkPkg/NetworkDefines.dsc.inc
new file mode 100644
index 000000000000..648c065baadb
--- /dev/null
+++ b/NetworkPkg/NetworkDefines.dsc.inc
@@ -0,0 +1,138 @@
+## @file
+# Network DSC include file for [Defines] section of all Architectures.
+#
+# This file can be included to the [Defines] section of a platform DSC file by
+# using "!include NetworkPkg/NetworkDefines.dsc.inc" to set default value of
+# flags if they are not defined somewhere else, and also check the value to see
+# if there is any conflict.
+#
+# These flags can be defined before the !include line, or changed on the command
+# line to enable or disable related feature support.
+#   -D FLAG=VALUE
+# The default value of these flags are:
+#   DEFINE NETWORK_ENABLE                 = TRUE
+#   DEFINE NETWORK_SNP_ENABLE             = TRUE
+#   DEFINE NETWORK_IP4_ENABLE             = TRUE
+#   DEFINE NETWORK_IP6_ENABLE             = TRUE
+#   DEFINE NETWORK_TLS_ENABLE             = TRUE
+#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
+#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
+#   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
+#   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
+#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
+#
+# Copyright (c) 2018, 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 text of the license may be found at
+#    http://opensource.org/licenses/bsd-license.php
+#
+#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+!ifndef NETWORK_ENABLE
+  #
+  # This flag is to enable or disable the whole network stack.
+  #
+  DEFINE NETWORK_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_SNP_ENABLE
+  #
+  # This flag is to include the common SNP driver or not.
+  #
+  DEFINE NETWORK_SNP_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_VLAN_ENABLE
+  #
+  # This flag is to enable or disable VLAN feature.
+  #
+  DEFINE NETWORK_VLAN_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_IP4_ENABLE
+  #
+  # This flag is to enable or disable IPv4 network stack.
+  #
+  DEFINE NETWORK_IP4_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_IP6_ENABLE
+  #
+  # This flag is to enable or disable IPv6 network stack.
+  #
+  DEFINE NETWORK_IP6_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_TLS_ENABLE
+  #
+  # This flag is to enable or disable TLS feature.
+  #
+  # Note: This feature depends on the OpenSSL building. To enable this feature, please
+  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
+  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
+  #       The OpensslLib.inf library instance should be used since libssl is required.
+  #
+  DEFINE NETWORK_TLS_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_HTTP_BOOT_ENABLE
+  #
+  # This flag is to enable or disable HTTP(S) boot feature.
+  #
+  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_ALLOW_HTTP_CONNECTIONS
+  #
+  # Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
+  #
+  # Note: If NETWORK_ALLOW_HTTP_CONNECTIONS is TRUE, HTTP connections are allowed.
+  #       Both the "https://" and "http://" URI schemes are permitted. Otherwise, HTTP
+  #       connections are denied. Only the "https://" URI scheme is permitted.
+  #
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
+!endif
+
+!ifndef NETWORK_ISCSI_ENABLE
+  #
+  # This flag is to enable or disable iSCSI feature.
+  #
+  # Note: This feature depends on the OpenSSL building. To enable this feature, please
+  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
+  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
+  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
+  #       since libssl is not required for iSCSI.
+  #
+  DEFINE NETWORK_ISCSI_ENABLE = TRUE
+!endif
+
+!ifndef NETWORK_IPSEC_ENABLE
+  #
+  # This flag is to enable or disable IPsec feature.
+  #
+  # Note: This feature depends on the OpenSSL building. To enable this feature, please
+  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
+  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
+  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
+  #       since libssl is not required for IPsec.
+  #
+  DEFINE NETWORK_IPSEC_ENABLE = TRUE
+!endif
+
+!if $(NETWORK_ENABLE) == TRUE
+  #
+  # Check the flags to see if there is any conflict.
+  #
+  !if ($(NETWORK_IP4_ENABLE) == FALSE) AND ($(NETWORK_IP6_ENABLE) == FALSE)
+    !error "Must enable at least IP4 or IP6 stack if NETWORK_ENABLE is set to TRUE!"
+  !endif
+
+  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND ($(NETWORK_TLS_ENABLE) == FALSE) AND ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
+    !error "Must enable TLS to support HTTPS, or allow unsecured HTTP connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
+  !endif
+!endif
diff --git a/NetworkPkg/NetworkLibs.dsc.inc b/NetworkPkg/NetworkLibs.dsc.inc
new file mode 100644
index 000000000000..67d09c262074
--- /dev/null
+++ b/NetworkPkg/NetworkLibs.dsc.inc
@@ -0,0 +1,25 @@
+## @file
+# Network DSC include file for [LibraryClasses*] section of all Architectures.
+#
+# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
+# by using "!include NetworkPkg/NetworkLibs.dsc.inc" to specify the library instances
+# of EDKII network library classes.
+#
+# Copyright (c) 2018, 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 text of the license may be found at
+#    http://opensource.org/licenses/bsd-license.php
+#
+#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
diff --git a/NetworkPkg/NetworkPcds.dsc.inc b/NetworkPkg/NetworkPcds.dsc.inc
new file mode 100644
index 000000000000..3eee5b3ae0bf
--- /dev/null
+++ b/NetworkPkg/NetworkPcds.dsc.inc
@@ -0,0 +1,22 @@
+## @file
+# Network DSC include file for [Pcds*] section of all Architectures.
+#
+# This file can be included to the [Pcds*] section(s) of a platform DSC file
+# by using "!include NetworkPkg/NetworkPcds.dsc.inc" to specify PCD settings
+# according to the value of flags described in "NetworkDefines.dsc.inc".
+#
+# Copyright (c) 2018, 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 text of the license may be found at
+#    http://opensource.org/licenses/bsd-license.php
+#
+#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+!if $(NETWORK_ALLOW_HTTP_CONNECTIONS) == TRUE
+  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
+!endif
diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index b543caa08fb1..654f73785054 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -24,6 +24,8 @@ [Defines]
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT
 
+!include NetworkPkg/NetworkDefines.dsc.inc
+
 [LibraryClasses]
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
@@ -47,12 +49,8 @@ [LibraryClasses]
   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!include NetworkPkg/NetworkLibs.dsc.inc
+
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -86,6 +84,7 @@ [PcdsFeatureFlag]
 [PcdsFixedAtBuild]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
+!include NetworkPkg/NetworkPcds.dsc.inc
 
 ###################################################################################################
 #
@@ -107,25 +106,10 @@ [PcdsFixedAtBuild]
 ###################################################################################################
 
 [Components]
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!include NetworkPkg/NetworkComponents.dsc.inc
 
   NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
   NetworkPkg/Application/VConfig/VConfig.inf
 
-[Components.IA32, Components.X64]
-  NetworkPkg/IpSecDxe/IpSecDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/TlsDxe/TlsDxe.inf
-  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
-
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 2/6] Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 3/6] ArmVirtPkg: " Fu Siyuan
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Hao Wu

This patch updates the platform DSC/FDF files to use the include fragment
files provided by NetworkPkg.
The feature enabling flags in [Defines] section have be updated to use the
NetworkPkg's terms, and the value have been overridden with the original
default value on this platform.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---

Notes:
    v2:
    Change the !if reference of TLS_ENABLE to NETWORK_TLS_ENABLE for OpensslLib.

 Nt32Pkg/Nt32Pkg.dsc | 104 ++++++--------------
 Nt32Pkg/Nt32Pkg.fdf |  27 +----
 2 files changed, 31 insertions(+), 100 deletions(-)

diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 4dbde0cc45b6..06d6407d593c 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -44,39 +44,20 @@ [Defines]
   # Defines for default states.  These can be changed on the command line.
   # -D FLAG=VALUE
   #
-  # Note: Secure Boot feature highly depends on the OpenSSL building. To enable this 
-  #       feature, please follow the instructions found in the file "Patch-HOWTO.txt" 
+  # Note: Secure Boot feature highly depends on the OpenSSL building. To enable this
+  #       feature, please follow the instructions found in the file "Patch-HOWTO.txt"
   #       located in CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
   #
   DEFINE SECURE_BOOT_ENABLE      = FALSE
-  
-  #
-  # This flag is to enable or disable TLS feature.  
-  # These can be changed on the command line.
-  # -D FLAG=VALUE
-  #
-  # Note: TLS feature highly depends on the OpenSSL building. To enable this 
-  #       feature, please follow the instructions found in the file "Patch-HOWTO.txt" 
-  #       located in CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
-  #
-  DEFINE TLS_ENABLE = FALSE
-  
-  #
-  # Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
-  # -D FLAG=VALUE
-  #
-  # Note: If ALLOW_HTTP_CONNECTIONS is TRUE, HTTP connections are allowed. Both 
-  #       the "https://" and "http://" URI schemes are permitted. Otherwise, HTTP 
-  #       connections are denied. Only the "https://" URI scheme is permitted.
-  #
-  DEFINE ALLOW_HTTP_CONNECTIONS = TRUE
 
   #
-  # This flag is to enable or disable IPv6 network stack.
-  # These can be changed on the command line.
-  # -D FLAG=VALUE
+  # SnpNt32Dxe.inf will be used.
   #
-  DEFINE NETWORK_IP6_ENABLE = FALSE
+  DEFINE NETWORK_SNP_ENABLE             = FALSE
+  DEFINE NETWORK_IP6_ENABLE             = FALSE
+  DEFINE NETWORK_TLS_ENABLE             = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+!include NetworkPkg/NetworkDefines.dsc.inc
 
 ################################################################################
 #
@@ -133,18 +114,12 @@ [LibraryClasses]
   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
-  
+
   #
   # Generic Modules
   #
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -153,6 +128,12 @@ [LibraryClasses]
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
+
   #
   # Platform
   #
@@ -168,12 +149,12 @@ [LibraryClasses]
   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
   ResetSystemLib|Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf
-!if $(TLS_ENABLE) == TRUE
+!if $(NETWORK_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
 !endif
-  
+
 !if $(SECURE_BOOT_ENABLE) == TRUE
   PlatformSecureLib|Nt32Pkg/Library/PlatformSecureLib/PlatformSecureLib.inf
   TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
@@ -245,7 +226,7 @@ [LibraryClasses.common.UEFI_DRIVER]
 [LibraryClasses.common.UEFI_APPLICATION]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
-  
+
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   #
   # Runtime
@@ -276,10 +257,10 @@ [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
 
-!if $(ALLOW_HTTP_CONNECTIONS) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
-
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
@@ -287,7 +268,7 @@ [PcdsFixedAtBuild]
   gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
   gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
 !endif
-                        
+
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
 
 
@@ -362,7 +343,7 @@ [Components]
   Nt32Pkg/BootModePei/BootModePei.inf
   Nt32Pkg/StallPei/StallPei.inf
   Nt32Pkg/WinNtFlashMapPei/WinNtFlashMapPei.inf
-  
+
   MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
   MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
 
@@ -394,7 +375,7 @@ [Components]
     <LibraryClasses>
 !if $(SECURE_BOOT_ENABLE) == TRUE
       NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
-!endif 
+!endif
   }
   MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
@@ -457,35 +438,8 @@ [Components]
   # Network stack drivers
   # To test network drivers, need network Io driver(SnpNt32Io.dll), please refer to NETWORK-IO Subproject.
   #
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
   Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
-
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-   
-!if $(TLS_ENABLE) == TRUE
-  NetworkPkg/TlsDxe/TlsDxe.inf
-  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf{
@@ -534,9 +488,9 @@ [Components]
 ###################################################################################################
 #
 # BuildOptions Section - Define the module specific tool chain flags that should be used as
-#                        the default flags for a module. These flags are appended to any 
-#                        standard flags that are defined by the build process. They can be 
-#                        applied for any modules or only those modules with the specific 
+#                        the default flags for a module. These flags are appended to any
+#                        standard flags that are defined by the build process. They can be
+#                        applied for any modules or only those modules with the specific
 #                        module style (EDK or EDKII) specified in [Components] section.
 #
 ###################################################################################################
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index b65c95201b36..3e7b4477f753 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -249,32 +249,9 @@ [FV.FvRecovery]
 INF  MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
 INF  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
 
-INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-INF  NetworkPkg/TcpDxe/TcpDxe.inf
-INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
 INF  Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-INF  NetworkPkg/DnsDxe/DnsDxe.inf
-INF  NetworkPkg/HttpDxe/HttpDxe.inf
-INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-!if $(TLS_ENABLE) == TRUE
-INF  NetworkPkg/TlsDxe/TlsDxe.inf
-INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
-!endif
+!include NetworkPkg/Network.fdf.inc
+
 INF  MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
 ################################################################################
 #
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 3/6] ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 2/6] Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-23 12:29   ` Laszlo Ersek
  2018-11-23 16:50   ` Laszlo Ersek
  2018-11-22  5:21 ` [PATCH v2 4/6] EmulatorPkg: " Fu Siyuan
                   ` (4 subsequent siblings)
  7 siblings, 2 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel; +Cc: Laszlo Ersek, Ard Biesheuvel, Julien Grall

This patch updates the platform DSC/FDF files to use the include fragment
files provided by NetworkPkg.
The feature enabling flags in [Defines] section have been updated to use
the NetworkPkg's terms, and the value has been overridden with the original
default value on this platform.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 ArmVirtPkg/ArmVirt.dsc.inc           | 11 +----
 ArmVirtPkg/ArmVirtQemu.dsc           | 46 ++++++--------------
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 28 +-----------
 ArmVirtPkg/ArmVirtQemuKernel.dsc     | 46 ++++++--------------
 4 files changed, 28 insertions(+), 103 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 70a0ac4d786c..d7de73a88eff 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -76,16 +76,7 @@ [LibraryClasses.common]
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
 
   # Networking Requirements
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
-!endif
+!include NetworkPkg/NetworkLibs.dsc.inc
 
   #
   # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 885c6b14b844..1414b6a5ccf8 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -33,9 +33,14 @@ [Defines]
   # Defines for default states.  These can be changed on the command line.
   # -D FLAG=VALUE
   #
-  DEFINE SECURE_BOOT_ENABLE      = FALSE
-  DEFINE NETWORK_IP6_ENABLE      = FALSE
-  DEFINE HTTP_BOOT_ENABLE        = FALSE
+  DEFINE SECURE_BOOT_ENABLE              = FALSE
+  DEFINE NETWORK_IP6_ENABLE              = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE        = FALSE
+  DEFINE NETWORK_SNP_ENABLE              = FALSE
+  DEFINE NETWORK_TLS_ENABLE              = FALSE
+  DEFINE NETWORK_IPSEC_ENABLE            = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS  = TRUE
+!include NetworkPkg/NetworkDefines.dsc.inc
 
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
@@ -123,9 +128,10 @@ [PcdsFixedAtBuild.common]
   #
   gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
   # System Memory Base -- fixed at 0x4000_0000
   gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
@@ -338,33 +344,7 @@ [Components.common]
   #
   # Networking stack
   #
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!else
-  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
   #
   # SCSI Bus and Disk Driver
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index a6390bd4b841..560651e49e0b 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -118,33 +118,7 @@ [FV.FvMain]
   #
   # Networking stack
   #
-  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  INF NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF NetworkPkg/TcpDxe/TcpDxe.inf
-  INF NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF NetworkPkg/IScsiDxe/IScsiDxe.inf
-!else
-  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  INF NetworkPkg/DnsDxe/DnsDxe.inf
-  INF NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  INF NetworkPkg/HttpDxe/HttpDxe.inf
-  INF NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
+!include NetworkPkg/Network.fdf.inc
 
   #
   # SCSI Bus and Disk Driver
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 434d6861a56f..e1f5dd3f0df2 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -33,9 +33,14 @@ [Defines]
   # Defines for default states.  These can be changed on the command line.
   # -D FLAG=VALUE
   #
-  DEFINE SECURE_BOOT_ENABLE      = FALSE
-  DEFINE NETWORK_IP6_ENABLE      = FALSE
-  DEFINE HTTP_BOOT_ENABLE        = FALSE
+  DEFINE SECURE_BOOT_ENABLE              = FALSE
+  DEFINE NETWORK_IP6_ENABLE              = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE        = FALSE
+  DEFINE NETWORK_SNP_ENABLE              = FALSE
+  DEFINE NETWORK_TLS_ENABLE              = FALSE
+  DEFINE NETWORK_IPSEC_ENABLE            = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS  = TRUE
+!include NetworkPkg/NetworkDefines.dsc.inc
 
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
@@ -126,9 +131,10 @@ [PcdsFixedAtBuild.common]
   #
   gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
 [PcdsPatchableInModule.common]
   #
@@ -327,33 +333,7 @@ [Components.common]
   #
   # Networking stack
   #
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!else
-  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
   #
   # SCSI Bus and Disk Driver
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 4/6] EmulatorPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
                   ` (2 preceding siblings ...)
  2018-11-22  5:21 ` [PATCH v2 3/6] ArmVirtPkg: " Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jordan Justen, Andrew Fish, Ruiyu Ni

This patch updates the platform DSC/FDF files to use the include fragment
files provided by NetworkPkg.
The feature enabling flags in [Defines] section have been updated to use
the NetworkPkg's terms, and the value has been overridden with the original
default value on this platform.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 EmulatorPkg/EmulatorPkg.dsc | 39 +++++++++++++-------
 EmulatorPkg/EmulatorPkg.fdf | 10 +----
 2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 4097e1192ebc..b819f438c407 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -29,6 +29,21 @@ [Defines]
   SKUID_IDENTIFIER               = DEFAULT
   FLASH_DEFINITION               = EmulatorPkg/EmulatorPkg.fdf
 
+  #
+  # Network stack drivers
+  #
+  
+  #
+  # EmuSnpDxe.inf will be used.
+  #
+  DEFINE NETWORK_SNP_ENABLE       = FALSE
+  DEFINE NETWORK_IP6_ENABLE       = FALSE
+  DEFINE NETWORK_TLS_ENABLE       = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE
+  DEFINE NETWORK_IPSEC_ENABLE     = FALSE
+  DEFINE NETWORK_ISCSI_ENABLE     = FALSE
+!include NetworkPkg/NetworkDefines.dsc.inc
+
 [SkuIds]
   0|DEFAULT
 
@@ -74,10 +89,6 @@ [LibraryClasses]
   # Generic Modules
   #
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
@@ -89,6 +100,11 @@ [LibraryClasses]
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
+
   #
   # Platform
   #
@@ -225,6 +241,11 @@ [PcdsFixedAtBuild]
   #  0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
 
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
+
 [PcdsDynamicDefault.common.DEFAULT]
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
@@ -368,15 +389,7 @@ [Components]
   #
   # Network stack drivers
   #
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
+!include NetworkPkg/NetworkComponents.dsc.inc
 
   MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 45697da25860..a8b46be66083 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -196,15 +196,7 @@ [FV.FvRecovery]
 !if $(NETWORK_SUPPORT)
 INF  EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
 !endif
-INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-INF  NetworkPkg/TcpDxe/TcpDxe.inf
-INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+!include NetworkPkg/Network.fdf.inc
 
 INF FatPkg/EnhancedFatDxe/Fat.inf
 
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 5/6] OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
                   ` (3 preceding siblings ...)
  2018-11-22  5:21 ` [PATCH v2 4/6] EmulatorPkg: " Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-23 12:00   ` Laszlo Ersek
                     ` (2 more replies)
  2018-11-22  5:21 ` [PATCH v2 6/6] Vlv2TbltDevicePkg: " Fu Siyuan
                   ` (2 subsequent siblings)
  7 siblings, 3 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel
  Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Anthony Perard,
	Julien Grall

This patch updates the platform DSC/FDF files to use the include fragment
files provided by NetworkPkg.
The feature enabling flags in [Defines] section have been updated to use
the NetworkPkg's terms, and the value has been overridden with the original
default value on this platform.

This patch also rename the TLS_ENABLE flag to PLATFORM_TLS_ENABLE for the
platform specific configuration for TLS support.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---

Notes:
    v2:
    Rename TLS_ENABLE flag to PLATFORM_TLS_ENABLE flag for platform specific configuration for TLS support.

 OvmfPkg/OvmfPkgIa32.dsc    | 75 +++++++++----------
 OvmfPkg/OvmfPkgIa32.fdf    | 27 +------
 OvmfPkg/OvmfPkgIa32X64.dsc | 76 +++++++++-----------
 OvmfPkg/OvmfPkgIa32X64.fdf | 27 +------
 OvmfPkg/OvmfPkgX64.dsc     | 75 +++++++++----------
 OvmfPkg/OvmfPkgX64.fdf     | 27 +------
 6 files changed, 102 insertions(+), 205 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index eccf34d3d1cb..adedd2240a8a 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -35,12 +35,25 @@ [Defines]
   # -D FLAG=VALUE
   #
   DEFINE SECURE_BOOT_ENABLE      = FALSE
-  DEFINE NETWORK_IP6_ENABLE      = FALSE
-  DEFINE HTTP_BOOT_ENABLE        = FALSE
   DEFINE SMM_REQUIRE             = FALSE
-  DEFINE TLS_ENABLE              = FALSE
   DEFINE TPM2_ENABLE             = FALSE
 
+  #
+  # PLATFORM_TLS_ENABLE flag is used to control platform specific configuration for TLS support,
+  # which add a NULL class library instance to TlsAuthConfigDxe.inf for downloading the necessary
+  # data from QEMU via fw_cfg.
+  #
+  DEFINE PLATFORM_TLS_ENABLE            = FALSE
+  #
+  # The NETWORK_TLS_ENABLE should always be set to FALSE since PLATFORM_TLS_ENABLE is used.
+  #
+  DEFINE NETWORK_TLS_ENABLE             = FALSE
+  DEFINE NETWORK_IP6_ENABLE             = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+  DEFINE NETWORK_IPSEC_ENABLE           = FALSE
+!include NetworkPkg/NetworkDefines.dsc.inc
+
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
   # one of the supported values, in place of any of the convenience macros, is
@@ -144,10 +157,6 @@ [LibraryClasses]
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
@@ -173,7 +182,7 @@ [LibraryClasses]
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -191,11 +200,12 @@ [LibraryClasses]
 
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
@@ -442,7 +452,7 @@ [PcdsFixedAtBuild]
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
 !endif
@@ -450,12 +460,12 @@ [PcdsFixedAtBuild]
 !if $(FD_SIZE_IN_KB) == 4096
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000
 !endif
 !endif
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
 !endif
@@ -504,9 +514,10 @@ [PcdsFixedAtBuild]
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
 !endif
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
 
@@ -777,31 +788,9 @@ [Components]
   #
   # Network Support
   #
-  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/NetworkComponents.dsc.inc
+
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   NetworkPkg/TlsDxe/TlsDxe.inf
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index f7f9ab06bb5a..995328992ccf 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -296,31 +296,8 @@ [FV.DXEFV]
 #
 # Network modules
 #
-  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF  NetworkPkg/TcpDxe/TcpDxe.inf
-  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  INF  NetworkPkg/DnsDxe/DnsDxe.inf
-  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  INF  NetworkPkg/HttpDxe/HttpDxe.inf
-  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/Network.fdf.inc
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   INF  NetworkPkg/TlsDxe/TlsDxe.inf
   INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 4ac4faf5dc18..95c4fab60ada 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -35,12 +35,25 @@ [Defines]
   # -D FLAG=VALUE
   #
   DEFINE SECURE_BOOT_ENABLE      = FALSE
-  DEFINE NETWORK_IP6_ENABLE      = FALSE
-  DEFINE HTTP_BOOT_ENABLE        = FALSE
   DEFINE SMM_REQUIRE             = FALSE
-  DEFINE TLS_ENABLE              = FALSE
   DEFINE TPM2_ENABLE             = FALSE
 
+  #
+  # PLATFORM_TLS_ENABLE flag is used to control platform specific configuration for TLS support,
+  # which add a NULL class library instance to TlsAuthConfigDxe.inf for downloading the necessary
+  # data from QEMU via fw_cfg.
+  #
+  DEFINE PLATFORM_TLS_ENABLE            = FALSE
+  #
+  # The NETWORK_TLS_ENABLE should always be set to FALSE since PLATFORM_TLS_ENABLE is used.
+  #
+  DEFINE NETWORK_TLS_ENABLE             = FALSE
+  DEFINE NETWORK_IP6_ENABLE             = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+  DEFINE NETWORK_IPSEC_ENABLE           = FALSE
+!include NetworkPkg/NetworkDefines.dsc.inc
+
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
   # one of the supported values, in place of any of the convenience macros, is
@@ -149,10 +162,6 @@ [LibraryClasses]
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
@@ -178,7 +187,7 @@ [LibraryClasses]
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -196,11 +205,12 @@ [LibraryClasses]
 
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
@@ -447,7 +457,7 @@ [PcdsFixedAtBuild]
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
 !endif
@@ -455,12 +465,12 @@ [PcdsFixedAtBuild]
 !if $(FD_SIZE_IN_KB) == 4096
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000
 !endif
 !endif
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
 !endif
@@ -509,10 +519,10 @@ [PcdsFixedAtBuild]
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
 !endif
 
-[PcdsFixedAtBuild.X64]
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
 
@@ -786,31 +796,9 @@ [Components.X64]
   #
   # Network Support
   #
-  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/NetworkComponents.dsc.inc
+
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   NetworkPkg/TlsDxe/TlsDxe.inf
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 067ea1993eaa..b86a7d5977d3 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -302,31 +302,8 @@ [FV.DXEFV]
     SECTION PE32 = Intel3.5/EFIX64/E3522X2.EFI
   }
 !endif
-  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF  NetworkPkg/TcpDxe/TcpDxe.inf
-  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  INF  NetworkPkg/DnsDxe/DnsDxe.inf
-  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  INF  NetworkPkg/HttpDxe/HttpDxe.inf
-  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/Network.fdf.inc
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   INF  NetworkPkg/TlsDxe/TlsDxe.inf
   INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ecd5db416c47..f2697bfaf5c0 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -35,12 +35,25 @@ [Defines]
   # -D FLAG=VALUE
   #
   DEFINE SECURE_BOOT_ENABLE      = FALSE
-  DEFINE NETWORK_IP6_ENABLE      = FALSE
-  DEFINE HTTP_BOOT_ENABLE        = FALSE
   DEFINE SMM_REQUIRE             = FALSE
-  DEFINE TLS_ENABLE              = FALSE
   DEFINE TPM2_ENABLE             = FALSE
 
+  #
+  # PLATFORM_TLS_ENABLE flag is used to control platform specific configuration for TLS support,
+  # which add a NULL class library instance to TlsAuthConfigDxe.inf for downloading the necessary
+  # data from QEMU via fw_cfg.
+  #
+  DEFINE PLATFORM_TLS_ENABLE            = FALSE
+  #
+  # The NETWORK_TLS_ENABLE should always be set to FALSE since PLATFORM_TLS_ENABLE is used.
+  #
+  DEFINE NETWORK_TLS_ENABLE             = FALSE
+  DEFINE NETWORK_IP6_ENABLE             = FALSE
+  DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
+  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
+  DEFINE NETWORK_IPSEC_ENABLE           = FALSE
+!include NetworkPkg/NetworkDefines.dsc.inc
+
   #
   # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
   # one of the supported values, in place of any of the convenience macros, is
@@ -149,10 +162,6 @@ [LibraryClasses]
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
@@ -178,7 +187,7 @@ [LibraryClasses]
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !else
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -196,11 +205,12 @@ [LibraryClasses]
 
   TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
 !endif
 
@@ -447,7 +457,7 @@ [PcdsFixedAtBuild]
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
 !endif
@@ -455,12 +465,12 @@ [PcdsFixedAtBuild]
 !if $(FD_SIZE_IN_KB) == 4096
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400
-!if $(TLS_ENABLE) == FALSE
+!if $(PLATFORM_TLS_ENABLE) == FALSE
   # match PcdFlashNvStorageVariableSize purely for convenience
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000
 !endif
 !endif
-!if $(TLS_ENABLE) == TRUE
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
 !endif
@@ -509,9 +519,10 @@ [PcdsFixedAtBuild]
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
 !endif
 
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
-!endif
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
 
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
 
@@ -784,31 +795,9 @@ [Components]
   #
   # Network Support
   #
-  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  NetworkPkg/TcpDxe/TcpDxe.inf
-  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  NetworkPkg/DnsDxe/DnsDxe.inf
-  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  NetworkPkg/HttpDxe/HttpDxe.inf
-  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/NetworkComponents.dsc.inc
+
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   NetworkPkg/TlsDxe/TlsDxe.inf
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 067ea1993eaa..b86a7d5977d3 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -302,31 +302,8 @@ [FV.DXEFV]
     SECTION PE32 = Intel3.5/EFIX64/E3522X2.EFI
   }
 !endif
-  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF  NetworkPkg/TcpDxe/TcpDxe.inf
-  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-!if $(NETWORK_IP6_ENABLE) == TRUE
-  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-!endif
-!if $(HTTP_BOOT_ENABLE) == TRUE
-  INF  NetworkPkg/DnsDxe/DnsDxe.inf
-  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
-  INF  NetworkPkg/HttpDxe/HttpDxe.inf
-  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
-!endif
-!if $(TLS_ENABLE) == TRUE
+!include NetworkPkg/Network.fdf.inc
+!if $(PLATFORM_TLS_ENABLE) == TRUE
   INF  NetworkPkg/TlsDxe/TlsDxe.inf
   INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
 !endif
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 6/6] Vlv2TbltDevicePkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
                   ` (4 preceding siblings ...)
  2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
@ 2018-11-22  5:21 ` Fu Siyuan
  2018-11-22  6:14 ` [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Gao, Liming
  2018-11-22 16:12 ` Laszlo Ersek
  7 siblings, 0 replies; 26+ messages in thread
From: Fu Siyuan @ 2018-11-22  5:21 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo

This patch updates the platform DSC/FDF files to use the include fragment
files provided by NetworkPkg.
The feature enabling flags in [Defines] section have been updated to use
the NetworkPkg's terms, and the value has been overridden with the original
default value on this platform.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf       | 25 +---------
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc | 11 +++--
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    | 25 +---------
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 52 ++++++--------------
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 52 ++++++--------------
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc    | 52 ++++++--------------
 6 files changed, 54 insertions(+), 163 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index f976b9fa4057..e281d1407fc2 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -728,35 +728,12 @@ [FV.FVMAIN]
 #
 # Network Modules
 #
+!include NetworkPkg/Network.fdf.inc
 !if $(NETWORK_ENABLE) == TRUE
   FILE DRIVER = 22DE1691-D65D-456a-993E-A253DD1F308C {
     SECTION PE32 = Vlv2MiscBinariesPkg/UNDI/RtkUndiDxe/$(DXE_ARCHITECTURE)/RtkUndiDxe.efi
     SECTION UI = "UNDI"
   }
-  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF  NetworkPkg/TcpDxe/TcpDxe.inf
-  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !if $(NETWORK_IP6_ENABLE) == TRUE
-  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
-  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  !endif
-  !if $(NETWORK_VLAN_ENABLE) == TRUE
-  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  !endif
-  !if $(NETWORK_ISCSI_ENABLE) == TRUE
-    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !endif
 !endif
 
 !if $(CAPSULE_ENABLE)
diff --git a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
index 672853dda6a6..a065e7e8e6a7 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
@@ -81,10 +81,13 @@
 
 DEFINE LZMA_ENABLE = TRUE
 DEFINE S4_ENABLE = TRUE
-DEFINE NETWORK_ENABLE = TRUE
-DEFINE NETWORK_IP6_ENABLE = TRUE
-DEFINE NETWORK_ISCSI_ENABLE = FALSE
-DEFINE NETWORK_VLAN_ENABLE = FALSE
+DEFINE NETWORK_ENABLE                 = TRUE
+DEFINE NETWORK_IP6_ENABLE             = TRUE
+DEFINE NETWORK_ISCSI_ENABLE           = FALSE
+DEFINE NETWORK_VLAN_ENABLE            = FALSE
+DEFINE NETWORK_TLS_ENABLE             = FALSE
+DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
+DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
 
 DEFINE SATA_ENABLE       = TRUE
 DEFINE PCIESC_ENABLE     = TRUE
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index 50032f7d5f19..6ea0ec92d4ae 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -684,35 +684,12 @@ [FV.FVMAIN]
 #
 # Network Modules
 #
+!include NetworkPkg/Network.fdf.inc
 !if $(NETWORK_ENABLE) == TRUE
   FILE DRIVER = 22DE1691-D65D-456a-993E-A253DD1F308C {
     SECTION PE32 = Vlv2MiscBinariesPkg/UNDI/RtkUndiDxe/$(DXE_ARCHITECTURE)/RtkUndiDxe.efi
     SECTION UI = "UNDI"
   }
-  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  INF  NetworkPkg/TcpDxe/TcpDxe.inf
-  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !if $(NETWORK_IP6_ENABLE) == TRUE
-  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-  INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
-  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-  !endif
-  !if $(NETWORK_VLAN_ENABLE) == TRUE
-  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  !endif
-  !if $(NETWORK_ISCSI_ENABLE) == TRUE
-    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !endif
 !endif
 
 !if $(CAPSULE_ENABLE)
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index f8ad29df5986..4a5417c61fcf 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -56,6 +56,11 @@ [Defines]
   !include $(PLATFORM_PACKAGE)/AutoPlatformCFG.txt
   !include $(PLATFORM_PACKAGE)/PlatformPkgConfig.dsc
 
+  #
+  # Network Stacks
+  #
+  !include NetworkPkg/NetworkDefines.dsc.inc
+  
 !if $(X64_CONFIG) == TRUE
   DEFINE      DXE_ARCHITECTURE        = X64
   DEFINE      EDK_DXE_ARCHITECTURE    = X64
@@ -173,13 +178,10 @@ [LibraryClasses.common]
 !if $(SCSI_ENABLE) == TRUE
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
 !endif
-!if $(NETWORK_ENABLE) == TRUE
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 !if $(S3_ENABLE) == TRUE
   S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
 !endif
@@ -721,6 +723,11 @@ [PcdsFixedAtBuild.common]
   #
 #  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest|{0}
 
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
+
 [PcdsFixedAtBuild.IA32]
 !if $(TARGET) == RELEASE
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
@@ -1528,40 +1535,11 @@ [Components.X64]
 
 
 !if $(NETWORK_ENABLE) == TRUE
-  !if $(NETWORK_ISCSI_ENABLE) == TRUE
-    NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !endif
-  !if $(NETWORK_VLAN_ENABLE) == TRUE
-    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  !endif
   !if $(CSM_ENABLE) == TRUE
     IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Snp16Dxe.inf
   !endif
 !endif
-
-!if $(NETWORK_ENABLE) == TRUE
-  #
-  # UEFI network modules
-  #
-    MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-
-    MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-    NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-    NetworkPkg/TcpDxe/TcpDxe.inf
-    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-    !if $(NETWORK_IP6_ENABLE) == TRUE
-      NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-      NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-      NetworkPkg/IpSecDxe/IpSecDxe.inf
-      NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-      NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-    !endif
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
 !if $(CAPSULE_ENABLE) || $(MICOCODE_CAPSULE_ENABLE)
   MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmpDxe.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index ca3b2ff90287..053634715ff3 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -56,6 +56,11 @@ [Defines]
   !include $(PLATFORM_PACKAGE)/AutoPlatformCFG.txt
   !include $(PLATFORM_PACKAGE)/PlatformPkgConfig.dsc
 
+  #
+  # Network Stacks
+  #
+  !include NetworkPkg/NetworkDefines.dsc.inc
+  
 !if $(X64_CONFIG) == TRUE
   DEFINE      DXE_ARCHITECTURE        = X64
   DEFINE      EDK_DXE_ARCHITECTURE    = X64
@@ -173,13 +178,10 @@ [LibraryClasses.common]
 !if $(SCSI_ENABLE) == TRUE
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
 !endif
-!if $(NETWORK_ENABLE) == TRUE
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 !if $(S3_ENABLE) == TRUE
   S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
 !endif
@@ -721,6 +723,11 @@ [PcdsFixedAtBuild.common]
   #
 #  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest|{0}
 
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
+
 [PcdsFixedAtBuild.IA32]
 !if $(TARGET) == RELEASE
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
@@ -1516,40 +1523,11 @@ [Components.IA32]
 
 
 !if $(NETWORK_ENABLE) == TRUE
-  !if $(NETWORK_ISCSI_ENABLE) == TRUE
-    NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !endif
-  !if $(NETWORK_VLAN_ENABLE) == TRUE
-    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  !endif
   !if $(CSM_ENABLE) == TRUE
     IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Snp16Dxe.inf
   !endif
 !endif
-
-!if $(NETWORK_ENABLE) == TRUE
-  #
-  # UEFI network modules
-  #
-    MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-
-    MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-    NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-    NetworkPkg/TcpDxe/TcpDxe.inf
-    !if $(NETWORK_IP6_ENABLE) == TRUE
-      NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-      NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-      NetworkPkg/IpSecDxe/IpSecDxe.inf
-      NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-      NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-    !endif
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
 !if $(CAPSULE_ENABLE) || $(MICOCODE_CAPSULE_ENABLE)
   MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmpDxe.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 81f36bd73b28..303663259940 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -56,6 +56,11 @@ [Defines]
   !include $(PLATFORM_PACKAGE)/AutoPlatformCFG.txt
   !include $(PLATFORM_PACKAGE)/PlatformPkgConfig.dsc
 
+  #
+  # Network Stacks
+  #
+  !include NetworkPkg/NetworkDefines.dsc.inc
+  
 !if $(X64_CONFIG) == TRUE
   DEFINE      DXE_ARCHITECTURE        = X64
   DEFINE      EDK_DXE_ARCHITECTURE    = X64
@@ -173,13 +178,10 @@ [LibraryClasses.common]
 !if $(SCSI_ENABLE) == TRUE
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
 !endif
-!if $(NETWORK_ENABLE) == TRUE
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-!endif
+  #
+  # Network libraries
+  #
+!include NetworkPkg/NetworkLibs.dsc.inc
 !if $(S3_ENABLE) == TRUE
   S3Lib|IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
 !endif
@@ -721,6 +723,11 @@ [PcdsFixedAtBuild.common]
   #
 #  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest|{0}
 
+  #
+  # Network Pcds
+  #
+!include NetworkPkg/NetworkPcds.dsc.inc
+
 [PcdsFixedAtBuild.IA32]
 !if $(TARGET) == RELEASE
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
@@ -1528,40 +1535,11 @@ [Components.X64]
 
 
 !if $(NETWORK_ENABLE) == TRUE
-  !if $(NETWORK_ISCSI_ENABLE) == TRUE
-    NetworkPkg/IScsiDxe/IScsiDxe.inf
-  !endif
-  !if $(NETWORK_VLAN_ENABLE) == TRUE
-    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  !endif
   !if $(CSM_ENABLE) == TRUE
     IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/Snp16Dxe.inf
   !endif
 !endif
-
-!if $(NETWORK_ENABLE) == TRUE
-  #
-  # UEFI network modules
-  #
-    MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
-
-    MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-    NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
-    NetworkPkg/TcpDxe/TcpDxe.inf
-    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-    !if $(NETWORK_IP6_ENABLE) == TRUE
-      NetworkPkg/Ip6Dxe/Ip6Dxe.inf
-      NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
-      NetworkPkg/IpSecDxe/IpSecDxe.inf
-      NetworkPkg/Udp6Dxe/Udp6Dxe.inf
-      NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
-    !endif
-!endif
+!include NetworkPkg/NetworkComponents.dsc.inc
 
 !if $(CAPSULE_ENABLE) || $(MICOCODE_CAPSULE_ENABLE)
   MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmpDxe.inf
-- 
2.19.1.windows.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
                   ` (5 preceding siblings ...)
  2018-11-22  5:21 ` [PATCH v2 6/6] Vlv2TbltDevicePkg: " Fu Siyuan
@ 2018-11-22  6:14 ` Gao, Liming
  2018-11-22 15:48   ` Laszlo Ersek
  2018-11-22 16:12 ` Laszlo Ersek
  7 siblings, 1 reply; 26+ messages in thread
From: Gao, Liming @ 2018-11-22  6:14 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Laszlo Ersek, Wei, David

Siyuan:
  Thanks for your contribution. I really like this idea to share the common DSC/FDF between all platform DSC/FDFs.  Now, FixedAtBuild PCD can also be used in the conditional statement. Its value can be specified by build command with --pcd option. So, I suggest to use FixedAtBuild PCD for network feature instead of MACRO. I would like to recommend to use PCD both for the build and firmware configuration. For this case, one UINT16 FixedAtBuildPcd can be introduced in NetworkPkg.dec.  Its different bit will be for the different network features. Below is the example. Besides, I think *.dsc.inc files need to include section header. If so, *.dsc.inc is the standalone dsc file. It can easily be included in platform DSC file. Especially for library instance, the different library instance may be for the different module type. Without section header, they can be placed into one *Libs.dsc.inc file. 

[Defines]
   DEFINE NETWORK_ENABLE                 = 0x1
   DEFINE NETWORK_SNP_ENABLE             = 0x2
   DEFINE NETWORK_IP4_ENABLE             = 0x4
   DEFINE NETWORK_IP6_ENABLE             = 0x8
   DEFINE NETWORK_TLS_ENABLE             = 0x10
   DEFINE NETWORK_HTTP_BOOT_ENABLE       = 0x20
   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = 0x40
   DEFINE NETWORK_IPSEC_ENABLE           = 0x80
   DEFINE NETWORK_ISCSI_ENABLE           = 0x100
   DEFINE NETWORK_VLAN_ENABLE            = 0x200

[PcdsFixedAtBuild]
   gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask|0xFFFF

[PcdsFixedAtBuild]
!if gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask & NETWORK_ALLOW_HTTP_CONNECTIONS == NETWORK_ALLOW_HTTP_CONNECTIONS
  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
!endif

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu
>Siyuan
>Sent: Thursday, November 22, 2018 1:22 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen,
>Jordan L <jordan.l.justen@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Wu,
>Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>;
>Laszlo Ersek <lersek@redhat.com>; Wei, David <david.wei@intel.com>
>Subject: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for
>network stack
>
>There is a patch to remove the redudant IP4 only iSCSI/PXE/TCP drivers
>from MdeModulePkg, which has been reviewed before edk2-stable201811
>tag.
>And we also have plan to move all network related libraries/modules to
>NetworkPkg. In order to make these change more smoothly, a set of
>fragment
>files (2 for DSC and 1 for FDF) are provided for platform to enable the
>network stack support, without directly reference the INF module path.
>
>Patch 1/6 adds centralized dsc/fdf include files to NetworkPkg, with
>a set of flags for feature set enable/disable.
>Patch 2~6 updates edk2 platform dsc/fdf files to use the new include
>files, instead of reference the module INF.
>
>v2:
>  1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
>  file. This could provide more flexibility to platform owner to use the
>  include files.
>  2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
>  3. Use "!error" statement for incorrect flag value check.
>  4. Update platform DSC/FDF to use the new include files.
>  5. Other decoration work according to Laszlo's comments.
>
>
>
>Fu Siyuan (6):
>  NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
>  Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>  ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>  EmulatorPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>  OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>  Vlv2TbltDevicePkg: Update DSC/FDF to use NetworkPkg's include fragment
>    file.
>
> ArmVirtPkg/ArmVirt.dsc.inc              |  11 +-
> ArmVirtPkg/ArmVirtQemu.dsc              |  46 ++-----
> ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc    |  28 +---
> ArmVirtPkg/ArmVirtQemuKernel.dsc        |  46 ++-----
> EmulatorPkg/EmulatorPkg.dsc             |  39 ++++--
> EmulatorPkg/EmulatorPkg.fdf             |  10 +-
> NetworkPkg/Network.fdf.inc              |  69 ++++++++++
> NetworkPkg/NetworkComponents.dsc.inc    |  71 ++++++++++
> NetworkPkg/NetworkDefines.dsc.inc       | 138 ++++++++++++++++++++
> NetworkPkg/NetworkLibs.dsc.inc          |  25 ++++
> NetworkPkg/NetworkPcds.dsc.inc          |  22 ++++
> NetworkPkg/NetworkPkg.dsc               |  28 +---
> Nt32Pkg/Nt32Pkg.dsc                     | 104 ++++-----------
> Nt32Pkg/Nt32Pkg.fdf                     |  27 +---
> OvmfPkg/OvmfPkgIa32.dsc                 |  75 +++++------
> OvmfPkg/OvmfPkgIa32.fdf                 |  27 +---
> OvmfPkg/OvmfPkgIa32X64.dsc              |  76 +++++------
> OvmfPkg/OvmfPkgIa32X64.fdf              |  27 +---
> OvmfPkg/OvmfPkgX64.dsc                  |  75 +++++------
> OvmfPkg/OvmfPkgX64.fdf                  |  27 +---
> Vlv2TbltDevicePkg/PlatformPkg.fdf       |  25 +---
> Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  11 +-
> Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    |  25 +---
> Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc |  52 +++-----
> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |  52 +++-----
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc    |  52 +++-----
> 26 files changed, 573 insertions(+), 615 deletions(-)
> create mode 100644 NetworkPkg/Network.fdf.inc
> create mode 100644 NetworkPkg/NetworkComponents.dsc.inc
> create mode 100644 NetworkPkg/NetworkDefines.dsc.inc
> create mode 100644 NetworkPkg/NetworkLibs.dsc.inc
> create mode 100644 NetworkPkg/NetworkPcds.dsc.inc
>
>Cc: Jiaxin Wu <jiaxin.wu@intel.com>
>Cc: Ting Ye <ting.ye@intel.com>
>Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Hao Wu <hao.a.wu@intel.com>
>Cc: Laszlo Ersek <lersek@redhat.com>
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Cc: Julien Grall <julien.grall@linaro.org>
>Cc: Jordan Justen <jordan.l.justen@intel.com>
>Cc: Andrew Fish <afish@apple.com>
>Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Anthony Perard <anthony.perard@citrix.com>
>Cc: David Wei <david.wei@intel.com>
>Cc: Mang Guo <mang.guo@intel.com>
>
>--
>2.19.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
@ 2018-11-22  9:56   ` Ni, Ruiyu
  2018-11-22 10:52     ` Fu, Siyuan
  2018-11-23 10:56   ` Laszlo Ersek
  1 sibling, 1 reply; 26+ messages in thread
From: Ni, Ruiyu @ 2018-11-22  9:56 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wu, Jiaxin, Gao,  Liming

Siyuan,
Can you merge all the dsc.inc together like below content?
[Defines]
...
[LIbraryClasses]
...
...

Through this way, platform only needs include once in DSC.

Thanks/Ray

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Fu
> Siyuan
> Sent: Thursday, November 22, 2018 1:22 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment
> files to NetworkPkg.
> 
> This patch provides a set of include segment files for platform owner to easily
> enable/disable network stack support on their platform.
> 
> For DSC, there are:
> - a "NetworkDefines.dsc.inc" for the [Defines] section(s),
> - a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
> - a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
> - a "NetworkComponents.dsc.inc" for the [Components*] section(s).
> For FDF, there is:
> - a "Network.fdf.inc" for the [Fv*] section(s).
> 
> These files can be added to the platform DSC/FDF file by using
>   !include NetworkPkg/xxx
> where "xxx" is the *.inc file name.
> 
> A set of flags can be changed before the include line or in build command line
> ("-D FLAG=VALUE") to enable or disable related feature set, please check
> "NetworkDefines.dsc.inc" for a detail description of each flag.
> 
> The default value of these flags are:
>   DEFINE NETWORK_ENABLE                 = TRUE
>   DEFINE NETWORK_SNP_ENABLE             = TRUE
>   DEFINE NETWORK_IP4_ENABLE             = TRUE
>   DEFINE NETWORK_IP6_ENABLE             = TRUE
>   DEFINE NETWORK_TLS_ENABLE             = TRUE
>   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
>   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
>   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
>   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
>   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> 
> Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293
> 
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Ting Ye <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
> 
> Notes:
>     v2:
>     1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
>     file. This could provide more flexibility to platform owner to use the
>     include files.
>     2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
>     3. Use "!error" statement for incorrect flag value check.
>     4. Other decoration work according to Laszlo's comments.
> 
>  NetworkPkg/Network.fdf.inc           |  69 ++++++++++
>  NetworkPkg/NetworkComponents.dsc.inc |  71 ++++++++++
>  NetworkPkg/NetworkDefines.dsc.inc    | 138 ++++++++++++++++++++
>  NetworkPkg/NetworkLibs.dsc.inc       |  25 ++++
>  NetworkPkg/NetworkPcds.dsc.inc       |  22 ++++
>  NetworkPkg/NetworkPkg.dsc            |  28 +---
>  6 files changed, 331 insertions(+), 22 deletions(-)
> 
> diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc new
> file mode 100644 index 000000000000..abd4c6c363d5
> --- /dev/null
> +++ b/NetworkPkg/Network.fdf.inc
> @@ -0,0 +1,69 @@
> +## @file
> +# Network FDF include file for All Architectures.
> +#
> +# This file can be included to a platform FDF by using "!include
> NetworkPkg/Network.fdf.inc"
> +# to add EDKII network stack drivers according to the value of flags
> +described in # "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be
> found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +#
> +
> +!if $(NETWORK_ENABLE) == TRUE
> +  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> +
> +  !if $(NETWORK_SNP_ENABLE) == TRUE
> +    INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> +    INF
> MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> +  !endif
> +
> +  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +
> +  !if $(NETWORK_IP4_ENABLE) == TRUE
> +    INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> +    INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IP6_ENABLE) == TRUE
> +    INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> +    INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> +    INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> +    INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> +  !endif
> +
> +  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> +  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> +
> +  !if $(NETWORK_TLS_ENABLE) == TRUE
> +    INF  NetworkPkg/TlsDxe/TlsDxe.inf
> +    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> +    INF  NetworkPkg/DnsDxe/DnsDxe.inf
> +    INF  NetworkPkg/HttpDxe/HttpDxe.inf
> +    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> +    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> +    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf  !endif
> +
> +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> +    INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
> +  !endif
> +!endif
> diff --git a/NetworkPkg/NetworkComponents.dsc.inc
> b/NetworkPkg/NetworkComponents.dsc.inc
> new file mode 100644
> index 000000000000..8074489b8e06
> --- /dev/null
> +++ b/NetworkPkg/NetworkComponents.dsc.inc
> @@ -0,0 +1,71 @@
> +## @file
> +# Network DSC include file for [Components*] section of all Architectures.
> +#
> +# This file can be included to the [Components*] section(s) of a
> +platform DSC file # by using "!include
> +NetworkPkg/NetworkComponents.dsc.inc" to specify the INF files # of
> +EDKII network drivers according to the value of flags described in #
> "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be
> found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!if $(NETWORK_ENABLE) == TRUE
> +  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> +
> +  !if $(NETWORK_SNP_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> +  !endif
> +
> +  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +
> +  !if $(NETWORK_IP4_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> +    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> +    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> +    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> +    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IP6_ENABLE) == TRUE
> +    NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> +    NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> +    NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> +    NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> +  !endif
> +
> +  NetworkPkg/TcpDxe/TcpDxe.inf
> +  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> +
> +  !if $(NETWORK_TLS_ENABLE) == TRUE
> +    NetworkPkg/TlsDxe/TlsDxe.inf
> +    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> +    NetworkPkg/DnsDxe/DnsDxe.inf
> +    NetworkPkg/HttpDxe/HttpDxe.inf
> +    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> +    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> +    NetworkPkg/IScsiDxe/IScsiDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> +    NetworkPkg/IpSecDxe/IpSecDxe.inf
> +  !endif
> +!endif
> diff --git a/NetworkPkg/NetworkDefines.dsc.inc
> b/NetworkPkg/NetworkDefines.dsc.inc
> new file mode 100644
> index 000000000000..648c065baadb
> --- /dev/null
> +++ b/NetworkPkg/NetworkDefines.dsc.inc
> @@ -0,0 +1,138 @@
> +## @file
> +# Network DSC include file for [Defines] section of all Architectures.
> +#
> +# This file can be included to the [Defines] section of a platform DSC
> +file by # using "!include NetworkPkg/NetworkDefines.dsc.inc" to set
> +default value of # flags if they are not defined somewhere else, and
> +also check the value to see # if there is any conflict.
> +#
> +# These flags can be defined before the !include line, or changed on
> +the command # line to enable or disable related feature support.
> +#   -D FLAG=VALUE
> +# The default value of these flags are:
> +#   DEFINE NETWORK_ENABLE                 = TRUE
> +#   DEFINE NETWORK_SNP_ENABLE             = TRUE
> +#   DEFINE NETWORK_IP4_ENABLE             = TRUE
> +#   DEFINE NETWORK_IP6_ENABLE             = TRUE
> +#   DEFINE NETWORK_TLS_ENABLE             = TRUE
> +#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> +#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> +#   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> +#   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> +#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> +#
> +# Copyright (c) 2018, 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 text of the license may be
> found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!ifndef NETWORK_ENABLE
> +  #
> +  # This flag is to enable or disable the whole network stack.
> +  #
> +  DEFINE NETWORK_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_SNP_ENABLE
> +  #
> +  # This flag is to include the common SNP driver or not.
> +  #
> +  DEFINE NETWORK_SNP_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_VLAN_ENABLE
> +  #
> +  # This flag is to enable or disable VLAN feature.
> +  #
> +  DEFINE NETWORK_VLAN_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_IP4_ENABLE
> +  #
> +  # This flag is to enable or disable IPv4 network stack.
> +  #
> +  DEFINE NETWORK_IP4_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_IP6_ENABLE
> +  #
> +  # This flag is to enable or disable IPv6 network stack.
> +  #
> +  DEFINE NETWORK_IP6_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_TLS_ENABLE
> +  #
> +  # This flag is to enable or disable TLS feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this
> feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       The OpensslLib.inf library instance should be used since libssl is
> required.
> +  #
> +  DEFINE NETWORK_TLS_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_HTTP_BOOT_ENABLE
> +  #
> +  # This flag is to enable or disable HTTP(S) boot feature.
> +  #
> +  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE !endif
> +
> +!ifndef NETWORK_ALLOW_HTTP_CONNECTIONS
> +  #
> +  # Indicates whether HTTP connections (i.e., unsecured) are permitted or
> not.
> +  #
> +  # Note: If NETWORK_ALLOW_HTTP_CONNECTIONS is TRUE, HTTP
> connections are allowed.
> +  #       Both the "https://" and "http://" URI schemes are permitted.
> Otherwise, HTTP
> +  #       connections are denied. Only the "https://" URI scheme is permitted.
> +  #
> +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE !endif
> +
> +!ifndef NETWORK_ISCSI_ENABLE
> +  #
> +  # This flag is to enable or disable iSCSI feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this
> feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be
> used
> +  #       since libssl is not required for iSCSI.
> +  #
> +  DEFINE NETWORK_ISCSI_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_IPSEC_ENABLE
> +  #
> +  # This flag is to enable or disable IPsec feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this
> feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be
> used
> +  #       since libssl is not required for IPsec.
> +  #
> +  DEFINE NETWORK_IPSEC_ENABLE = TRUE
> +!endif
> +
> +!if $(NETWORK_ENABLE) == TRUE
> +  #
> +  # Check the flags to see if there is any conflict.
> +  #
> +  !if ($(NETWORK_IP4_ENABLE) == FALSE) AND ($(NETWORK_IP6_ENABLE)
> == FALSE)
> +    !error "Must enable at least IP4 or IP6 stack if NETWORK_ENABLE is set to
> TRUE!"
> +  !endif
> +
> +  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND
> ($(NETWORK_TLS_ENABLE) == FALSE) AND
> ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
> +    !error "Must enable TLS to support HTTPS, or allow unsecured HTTP
> connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
> +  !endif
> +!endif
> diff --git a/NetworkPkg/NetworkLibs.dsc.inc
> b/NetworkPkg/NetworkLibs.dsc.inc new file mode 100644 index
> 000000000000..67d09c262074
> --- /dev/null
> +++ b/NetworkPkg/NetworkLibs.dsc.inc
> @@ -0,0 +1,25 @@
> +## @file
> +# Network DSC include file for [LibraryClasses*] section of all Architectures.
> +#
> +# This file can be included to the [LibraryClasses*] section(s) of a
> +platform DSC file # by using "!include NetworkPkg/NetworkLibs.dsc.inc"
> +to specify the library instances # of EDKII network library classes.
> +#
> +# Copyright (c) 2018, 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 text of the license may be
> found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +#
> +##
> +
> +  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> +  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> +  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> +  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> +  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> diff --git a/NetworkPkg/NetworkPcds.dsc.inc
> b/NetworkPkg/NetworkPcds.dsc.inc new file mode 100644 index
> 000000000000..3eee5b3ae0bf
> --- /dev/null
> +++ b/NetworkPkg/NetworkPcds.dsc.inc
> @@ -0,0 +1,22 @@
> +## @file
> +# Network DSC include file for [Pcds*] section of all Architectures.
> +#
> +# This file can be included to the [Pcds*] section(s) of a platform DSC
> +file # by using "!include NetworkPkg/NetworkPcds.dsc.inc" to specify
> +PCD settings # according to the value of flags described in
> "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be
> found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!if $(NETWORK_ALLOW_HTTP_CONNECTIONS) == TRUE
> +  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> +!endif
> diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
> index b543caa08fb1..654f73785054 100644
> --- a/NetworkPkg/NetworkPkg.dsc
> +++ b/NetworkPkg/NetworkPkg.dsc
> @@ -24,6 +24,8 @@ [Defines]
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
> 
> +!include NetworkPkg/NetworkDefines.dsc.inc
> +
>  [LibraryClasses]
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> @@ -47,12 +49,8 @@ [LibraryClasses]
> 
> DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
> eLib.inf
>    SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> 
> -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> +!include NetworkPkg/NetworkLibs.dsc.inc
> +
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> @@ -86,6 +84,7 @@ [PcdsFeatureFlag]
>  [PcdsFixedAtBuild]
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
> +!include NetworkPkg/NetworkPcds.dsc.inc
> 
> 
> ##########################################################
> #########################################
>  #
> @@ -107,25 +106,10 @@ [PcdsFixedAtBuild]
> ##########################################################
> #########################################
> 
>  [Components]
> -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  NetworkPkg/TcpDxe/TcpDxe.inf
> -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -  NetworkPkg/DnsDxe/DnsDxe.inf
> -  NetworkPkg/HttpDxe/HttpDxe.inf
> -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +!include NetworkPkg/NetworkComponents.dsc.inc
> 
>    NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
>    NetworkPkg/Application/VConfig/VConfig.inf
> 
> -[Components.IA32, Components.X64]
> -  NetworkPkg/IpSecDxe/IpSecDxe.inf
> -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  NetworkPkg/TlsDxe/TlsDxe.inf
> -  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> -
>  [BuildOptions]
>    *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> --
> 2.19.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-11-22  9:56   ` Ni, Ruiyu
@ 2018-11-22 10:52     ` Fu, Siyuan
  0 siblings, 0 replies; 26+ messages in thread
From: Fu, Siyuan @ 2018-11-22 10:52 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wu, Jiaxin, Gao,  Liming

Hi, Ray

It was one single file in v1 patch and I split it to 4 files in v2. Because there will be some problems if we include the section header, see Laszlo's comments on  https://lists.01.org/pipermail/edk2-devel/2018-November/032774.html


BestRegards
Fu Siyuan

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Thursday, November 22, 2018 5:57 PM
> To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Gao,
> Liming <liming.gao@intel.com>
> Subject: RE: [edk2] [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment
> files to NetworkPkg.
> 
> Siyuan,
> Can you merge all the dsc.inc together like below content?
> [Defines]
> ...
> [LIbraryClasses]
> ...
> ...
> 
> Through this way, platform only needs include once in DSC.
> 
> Thanks/Ray
> 
> > -----Original Message-----
> > From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Fu
> > Siyuan
> > Sent: Thursday, November 22, 2018 1:22 PM
> > To: edk2-devel@lists.01.org
> > Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> > Subject: [edk2] [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment
> > files to NetworkPkg.
> >
> > This patch provides a set of include segment files for platform owner to
> easily
> > enable/disable network stack support on their platform.
> >
> > For DSC, there are:
> > - a "NetworkDefines.dsc.inc" for the [Defines] section(s),
> > - a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
> > - a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
> > - a "NetworkComponents.dsc.inc" for the [Components*] section(s).
> > For FDF, there is:
> > - a "Network.fdf.inc" for the [Fv*] section(s).
> >
> > These files can be added to the platform DSC/FDF file by using
> >   !include NetworkPkg/xxx
> > where "xxx" is the *.inc file name.
> >
> > A set of flags can be changed before the include line or in build
> command line
> > ("-D FLAG=VALUE") to enable or disable related feature set, please check
> > "NetworkDefines.dsc.inc" for a detail description of each flag.
> >
> > The default value of these flags are:
> >   DEFINE NETWORK_ENABLE                 = TRUE
> >   DEFINE NETWORK_SNP_ENABLE             = TRUE
> >   DEFINE NETWORK_IP4_ENABLE             = TRUE
> >   DEFINE NETWORK_IP6_ENABLE             = TRUE
> >   DEFINE NETWORK_TLS_ENABLE             = TRUE
> >   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> >   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> >   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> >   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> >   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> >
> > Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293
> >
> > Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> > Cc: Ting Ye <ting.ye@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> > ---
> >
> > Notes:
> >     v2:
> >     1. Split the "Network.dsc.inc" in to 4 files for different sections
> in DSC
> >     file. This could provide more flexibility to platform owner to use
> the
> >     include files.
> >     2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable
> flag.
> >     3. Use "!error" statement for incorrect flag value check.
> >     4. Other decoration work according to Laszlo's comments.
> >
> >  NetworkPkg/Network.fdf.inc           |  69 ++++++++++
> >  NetworkPkg/NetworkComponents.dsc.inc |  71 ++++++++++
> >  NetworkPkg/NetworkDefines.dsc.inc    | 138 ++++++++++++++++++++
> >  NetworkPkg/NetworkLibs.dsc.inc       |  25 ++++
> >  NetworkPkg/NetworkPcds.dsc.inc       |  22 ++++
> >  NetworkPkg/NetworkPkg.dsc            |  28 +---
> >  6 files changed, 331 insertions(+), 22 deletions(-)
> >
> > diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc new
> > file mode 100644 index 000000000000..abd4c6c363d5
> > --- /dev/null
> > +++ b/NetworkPkg/Network.fdf.inc
> > @@ -0,0 +1,69 @@
> > +## @file
> > +# Network FDF include file for All Architectures.
> > +#
> > +# This file can be included to a platform FDF by using "!include
> > NetworkPkg/Network.fdf.inc"
> > +# to add EDKII network stack drivers according to the value of flags
> > +described in # "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license
> may be
> > found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +#
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> > +
> > +  !if $(NETWORK_SNP_ENABLE) == TRUE
> > +    INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> > +    INF
> > MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> > +  !endif
> > +
> > +  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> > +
> > +  !if $(NETWORK_IP4_ENABLE) == TRUE
> > +    INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IP6_ENABLE) == TRUE
> > +    INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > +    INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > +    INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > +    INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > +  !endif
> > +
> > +  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> > +  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > +
> > +  !if $(NETWORK_TLS_ENABLE) == TRUE
> > +    INF  NetworkPkg/TlsDxe/TlsDxe.inf
> > +    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> > +    INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +    INF  NetworkPkg/HttpDxe/HttpDxe.inf
> > +    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > +    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> > +    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf  !endif
> > +
> > +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> > +    INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
> > +  !endif
> > +!endif
> > diff --git a/NetworkPkg/NetworkComponents.dsc.inc
> > b/NetworkPkg/NetworkComponents.dsc.inc
> > new file mode 100644
> > index 000000000000..8074489b8e06
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkComponents.dsc.inc
> > @@ -0,0 +1,71 @@
> > +## @file
> > +# Network DSC include file for [Components*] section of all
> Architectures.
> > +#
> > +# This file can be included to the [Components*] section(s) of a
> > +platform DSC file # by using "!include
> > +NetworkPkg/NetworkComponents.dsc.inc" to specify the INF files # of
> > +EDKII network drivers according to the value of flags described in #
> > "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license
> may be
> > found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> > +
> > +  !if $(NETWORK_SNP_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> > +  !endif
> > +
> > +  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> > +
> > +  !if $(NETWORK_IP4_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> > +    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IP6_ENABLE) == TRUE
> > +    NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > +    NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > +    NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > +    NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > +  !endif
> > +
> > +  NetworkPkg/TcpDxe/TcpDxe.inf
> > +  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > +
> > +  !if $(NETWORK_TLS_ENABLE) == TRUE
> > +    NetworkPkg/TlsDxe/TlsDxe.inf
> > +    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> > +    NetworkPkg/DnsDxe/DnsDxe.inf
> > +    NetworkPkg/HttpDxe/HttpDxe.inf
> > +    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > +    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> > +    NetworkPkg/IScsiDxe/IScsiDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> > +    NetworkPkg/IpSecDxe/IpSecDxe.inf
> > +  !endif
> > +!endif
> > diff --git a/NetworkPkg/NetworkDefines.dsc.inc
> > b/NetworkPkg/NetworkDefines.dsc.inc
> > new file mode 100644
> > index 000000000000..648c065baadb
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkDefines.dsc.inc
> > @@ -0,0 +1,138 @@
> > +## @file
> > +# Network DSC include file for [Defines] section of all Architectures.
> > +#
> > +# This file can be included to the [Defines] section of a platform DSC
> > +file by # using "!include NetworkPkg/NetworkDefines.dsc.inc" to set
> > +default value of # flags if they are not defined somewhere else, and
> > +also check the value to see # if there is any conflict.
> > +#
> > +# These flags can be defined before the !include line, or changed on
> > +the command # line to enable or disable related feature support.
> > +#   -D FLAG=VALUE
> > +# The default value of these flags are:
> > +#   DEFINE NETWORK_ENABLE                 = TRUE
> > +#   DEFINE NETWORK_SNP_ENABLE             = TRUE
> > +#   DEFINE NETWORK_IP4_ENABLE             = TRUE
> > +#   DEFINE NETWORK_IP6_ENABLE             = TRUE
> > +#   DEFINE NETWORK_TLS_ENABLE             = TRUE
> > +#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> > +#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> > +#   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> > +#   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> > +#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> > +#
> > +# Copyright (c) 2018, 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 text of the license
> may be
> > found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!ifndef NETWORK_ENABLE
> > +  #
> > +  # This flag is to enable or disable the whole network stack.
> > +  #
> > +  DEFINE NETWORK_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_SNP_ENABLE
> > +  #
> > +  # This flag is to include the common SNP driver or not.
> > +  #
> > +  DEFINE NETWORK_SNP_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_VLAN_ENABLE
> > +  #
> > +  # This flag is to enable or disable VLAN feature.
> > +  #
> > +  DEFINE NETWORK_VLAN_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_IP4_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPv4 network stack.
> > +  #
> > +  DEFINE NETWORK_IP4_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_IP6_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPv6 network stack.
> > +  #
> > +  DEFINE NETWORK_IP6_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_TLS_ENABLE
> > +  #
> > +  # This flag is to enable or disable TLS feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this
> > feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> > located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building
> first.
> > +  #       The OpensslLib.inf library instance should be used since
> libssl is
> > required.
> > +  #
> > +  DEFINE NETWORK_TLS_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_HTTP_BOOT_ENABLE
> > +  #
> > +  # This flag is to enable or disable HTTP(S) boot feature.
> > +  #
> > +  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE !endif
> > +
> > +!ifndef NETWORK_ALLOW_HTTP_CONNECTIONS
> > +  #
> > +  # Indicates whether HTTP connections (i.e., unsecured) are permitted
> or
> > not.
> > +  #
> > +  # Note: If NETWORK_ALLOW_HTTP_CONNECTIONS is TRUE, HTTP
> > connections are allowed.
> > +  #       Both the "https://" and "http://" URI schemes are permitted.
> > Otherwise, HTTP
> > +  #       connections are denied. Only the "https://" URI scheme is
> permitted.
> > +  #
> > +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE !endif
> > +
> > +!ifndef NETWORK_ISCSI_ENABLE
> > +  #
> > +  # This flag is to enable or disable iSCSI feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this
> > feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> > located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building
> first.
> > +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance
> can be
> > used
> > +  #       since libssl is not required for iSCSI.
> > +  #
> > +  DEFINE NETWORK_ISCSI_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_IPSEC_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPsec feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this
> > feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt"
> > located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building
> first.
> > +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance
> can be
> > used
> > +  #       since libssl is not required for IPsec.
> > +  #
> > +  DEFINE NETWORK_IPSEC_ENABLE = TRUE
> > +!endif
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  #
> > +  # Check the flags to see if there is any conflict.
> > +  #
> > +  !if ($(NETWORK_IP4_ENABLE) == FALSE) AND ($(NETWORK_IP6_ENABLE)
> > == FALSE)
> > +    !error "Must enable at least IP4 or IP6 stack if NETWORK_ENABLE is
> set to
> > TRUE!"
> > +  !endif
> > +
> > +  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND
> > ($(NETWORK_TLS_ENABLE) == FALSE) AND
> > ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
> > +    !error "Must enable TLS to support HTTPS, or allow unsecured HTTP
> > connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
> > +  !endif
> > +!endif
> > diff --git a/NetworkPkg/NetworkLibs.dsc.inc
> > b/NetworkPkg/NetworkLibs.dsc.inc new file mode 100644 index
> > 000000000000..67d09c262074
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkLibs.dsc.inc
> > @@ -0,0 +1,25 @@
> > +## @file
> > +# Network DSC include file for [LibraryClasses*] section of all
> Architectures.
> > +#
> > +# This file can be included to the [LibraryClasses*] section(s) of a
> > +platform DSC file # by using "!include NetworkPkg/NetworkLibs.dsc.inc"
> > +to specify the library instances # of EDKII network library classes.
> > +#
> > +# Copyright (c) 2018, 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 text of the license
> may be
> > found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> > +  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> > +  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> > +  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> > +  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> > +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> > diff --git a/NetworkPkg/NetworkPcds.dsc.inc
> > b/NetworkPkg/NetworkPcds.dsc.inc new file mode 100644 index
> > 000000000000..3eee5b3ae0bf
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkPcds.dsc.inc
> > @@ -0,0 +1,22 @@
> > +## @file
> > +# Network DSC include file for [Pcds*] section of all Architectures.
> > +#
> > +# This file can be included to the [Pcds*] section(s) of a platform DSC
> > +file # by using "!include NetworkPkg/NetworkPcds.dsc.inc" to specify
> > +PCD settings # according to the value of flags described in
> > "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license
> may be
> > found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!if $(NETWORK_ALLOW_HTTP_CONNECTIONS) == TRUE
> > +  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> > +!endif
> > diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
> > index b543caa08fb1..654f73785054 100644
> > --- a/NetworkPkg/NetworkPkg.dsc
> > +++ b/NetworkPkg/NetworkPkg.dsc
> > @@ -24,6 +24,8 @@ [Defines]
> >    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> >    SKUID_IDENTIFIER               = DEFAULT
> >
> > +!include NetworkPkg/NetworkDefines.dsc.inc
> > +
> >  [LibraryClasses]
> >    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> >    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> > @@ -47,12 +49,8 @@ [LibraryClasses]
> >
> > DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
> > eLib.inf
> >    SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> >
> > -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> > -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> > -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> > -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> > -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> > -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> > +!include NetworkPkg/NetworkLibs.dsc.inc
> > +
> >    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> >    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> >    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> > @@ -86,6 +84,7 @@ [PcdsFeatureFlag]
> >  [PcdsFixedAtBuild]
> >    gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
> >    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
> > +!include NetworkPkg/NetworkPcds.dsc.inc
> >
> >
> > ##########################################################
> > #########################################
> >  #
> > @@ -107,25 +106,10 @@ [PcdsFixedAtBuild]
> > ##########################################################
> > #########################################
> >
> >  [Components]
> > -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > -  NetworkPkg/TcpDxe/TcpDxe.inf
> > -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > -  NetworkPkg/DnsDxe/DnsDxe.inf
> > -  NetworkPkg/HttpDxe/HttpDxe.inf
> > -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +!include NetworkPkg/NetworkComponents.dsc.inc
> >
> >    NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> >    NetworkPkg/Application/VConfig/VConfig.inf
> >
> > -[Components.IA32, Components.X64]
> > -  NetworkPkg/IpSecDxe/IpSecDxe.inf
> > -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> > -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > -  NetworkPkg/TlsDxe/TlsDxe.inf
> > -  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > -
> >  [BuildOptions]
> >    *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> > --
> > 2.19.1.windows.1
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-22  6:14 ` [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Gao, Liming
@ 2018-11-22 15:48   ` Laszlo Ersek
  2018-11-23 16:02     ` Gao, Liming
  0 siblings, 1 reply; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-22 15:48 UTC (permalink / raw)
  To: Gao, Liming, Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Wei, David

On 11/22/18 07:14, Gao, Liming wrote:
> Siyuan:
>   Thanks for your contribution. I really like this idea to share the
>   common DSC/FDF between all platform DSC/FDFs.  Now, FixedAtBuild PCD
>   can also be used in the conditional statement. Its value can be
>   specified by build command with --pcd option. So, I suggest to use
>   FixedAtBuild PCD for network feature instead of MACRO. I would like
>   to recommend to use PCD both for the build and firmware
>   configuration. For this case, one UINT16 FixedAtBuildPcd can be
>   introduced in NetworkPkg.dec.  Its different bit will be for the
>   different network features. Below is the example.

I disagree.

A bitmask is a very good representation for *computers*, to handle a set
of features. On the other hand, a bitmask is a catastrophically bad
representation for *humans*, when they are trying to configure a
platform build (that is, writing a build command line), selecting the
firmware features they want. It is hard to compute, and it is extremely
hard to grep for.

It is trivial to grep a build script for "NETWORK_TLS_ENABLE". It is
much harder to grep the same script for PcdNetworkFeatureMask, and then
check whether bit#4 is set in the value.

> Besides, I think *.dsc.inc files need to include section header. If
> so, *.dsc.inc is the standalone dsc file. It can easily be included in
> platform DSC file.

I disagree. For a platform, spelling out the section header is not a big
burden, but it provides a lot of flexibility. For example, it can
restrict the scope of the included text (e.g., component list) to a
specific architecture only. For another example, the platform's section
header can specify the flavor of the PCDs for which the included text
provides the default values (fixed PCD, patchable PCD, even dynamic(ex)
PCD).

Standalone DSC file is the wrong thing to aim for, in this instance --
in my opinion anyway. Yes, it appears simpler, but it loses too much
flexibility. In my earlier comments I pointed out that the "allow
plaintext HTTP connections" PCD was declared in NetworkPkg.dec as either
fixed or patchable. The dsc.inc file should not squander that
flexibility and dictate fixed only.

> Especially for library instance, the different library instance may be
> for the different module type. Without section header, they can be
> placed into one *Libs.dsc.inc file.

Ugh... I'm now condfused. Now it seems that you and I are asking for the
same thing actually. Did you perhaps mean, above, that "*.dsc.inc files
need *NOT* include section header"?

> [Defines]
>    DEFINE NETWORK_ENABLE                 = 0x1
>    DEFINE NETWORK_SNP_ENABLE             = 0x2
>    DEFINE NETWORK_IP4_ENABLE             = 0x4
>    DEFINE NETWORK_IP6_ENABLE             = 0x8
>    DEFINE NETWORK_TLS_ENABLE             = 0x10
>    DEFINE NETWORK_HTTP_BOOT_ENABLE       = 0x20
>    DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = 0x40
>    DEFINE NETWORK_IPSEC_ENABLE           = 0x80
>    DEFINE NETWORK_ISCSI_ENABLE           = 0x100
>    DEFINE NETWORK_VLAN_ENABLE            = 0x200
>
> [PcdsFixedAtBuild]
>    gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask|0xFFFF
>
> [PcdsFixedAtBuild]
> !if gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask & NETWORK_ALLOW_HTTP_CONNECTIONS == NETWORK_ALLOW_HTTP_CONNECTIONS
>   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> !endif

Sure, this looks good in the DSC include file, but it looks very bad on
the build command line. Compare:

  build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
    -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
    -D NETWORK_ENABLE -D NETWORK_IP4_ENABLE \
    -D NETWORK_HTTP_BOOT_ENABLE -D NETWORK_TLS_ENABLE

versus

  build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
    -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
    --pcd gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask=0x0035

First, composing the second command line takes at least four times as
long for me (calculating the value 0x35). Second, while

  grep NETWORK_IP4_ENABLE

will easily match the first command (in a shell script or similar), the
same search would require an awkward, ad-hoc parser for matching the
second command.

Thanks
Laszlo


>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu
>> Siyuan
>> Sent: Thursday, November 22, 2018 1:22 PM
>> To: edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen,
>> Jordan L <jordan.l.justen@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Wu,
>> Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>;
>> Laszlo Ersek <lersek@redhat.com>; Wei, David <david.wei@intel.com>
>> Subject: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for
>> network stack
>>
>> There is a patch to remove the redudant IP4 only iSCSI/PXE/TCP drivers
>>from MdeModulePkg, which has been reviewed before edk2-stable201811
>> tag.
>> And we also have plan to move all network related libraries/modules to
>> NetworkPkg. In order to make these change more smoothly, a set of
>> fragment
>> files (2 for DSC and 1 for FDF) are provided for platform to enable the
>> network stack support, without directly reference the INF module path.
>>
>> Patch 1/6 adds centralized dsc/fdf include files to NetworkPkg, with
>> a set of flags for feature set enable/disable.
>> Patch 2~6 updates edk2 platform dsc/fdf files to use the new include
>> files, instead of reference the module INF.
>>
>> v2:
>>  1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
>>  file. This could provide more flexibility to platform owner to use the
>>  include files.
>>  2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
>>  3. Use "!error" statement for incorrect flag value check.
>>  4. Update platform DSC/FDF to use the new include files.
>>  5. Other decoration work according to Laszlo's comments.
>>
>>
>>
>> Fu Siyuan (6):
>>  NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
>>  Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>>  ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>>  EmulatorPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>>  OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
>>  Vlv2TbltDevicePkg: Update DSC/FDF to use NetworkPkg's include fragment
>>    file.
>>
>> ArmVirtPkg/ArmVirt.dsc.inc              |  11 +-
>> ArmVirtPkg/ArmVirtQemu.dsc              |  46 ++-----
>> ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc    |  28 +---
>> ArmVirtPkg/ArmVirtQemuKernel.dsc        |  46 ++-----
>> EmulatorPkg/EmulatorPkg.dsc             |  39 ++++--
>> EmulatorPkg/EmulatorPkg.fdf             |  10 +-
>> NetworkPkg/Network.fdf.inc              |  69 ++++++++++
>> NetworkPkg/NetworkComponents.dsc.inc    |  71 ++++++++++
>> NetworkPkg/NetworkDefines.dsc.inc       | 138 ++++++++++++++++++++
>> NetworkPkg/NetworkLibs.dsc.inc          |  25 ++++
>> NetworkPkg/NetworkPcds.dsc.inc          |  22 ++++
>> NetworkPkg/NetworkPkg.dsc               |  28 +---
>> Nt32Pkg/Nt32Pkg.dsc                     | 104 ++++-----------
>> Nt32Pkg/Nt32Pkg.fdf                     |  27 +---
>> OvmfPkg/OvmfPkgIa32.dsc                 |  75 +++++------
>> OvmfPkg/OvmfPkgIa32.fdf                 |  27 +---
>> OvmfPkg/OvmfPkgIa32X64.dsc              |  76 +++++------
>> OvmfPkg/OvmfPkgIa32X64.fdf              |  27 +---
>> OvmfPkg/OvmfPkgX64.dsc                  |  75 +++++------
>> OvmfPkg/OvmfPkgX64.fdf                  |  27 +---
>> Vlv2TbltDevicePkg/PlatformPkg.fdf       |  25 +---
>> Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  11 +-
>> Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    |  25 +---
>> Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc |  52 +++-----
>> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |  52 +++-----
>> Vlv2TbltDevicePkg/PlatformPkgX64.dsc    |  52 +++-----
>> 26 files changed, 573 insertions(+), 615 deletions(-)
>> create mode 100644 NetworkPkg/Network.fdf.inc
>> create mode 100644 NetworkPkg/NetworkComponents.dsc.inc
>> create mode 100644 NetworkPkg/NetworkDefines.dsc.inc
>> create mode 100644 NetworkPkg/NetworkLibs.dsc.inc
>> create mode 100644 NetworkPkg/NetworkPcds.dsc.inc
>>
>> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
>> Cc: Ting Ye <ting.ye@intel.com>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Cc: Hao Wu <hao.a.wu@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Julien Grall <julien.grall@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Cc: Anthony Perard <anthony.perard@citrix.com>
>> Cc: David Wei <david.wei@intel.com>
>> Cc: Mang Guo <mang.guo@intel.com>
>>
>> --
>> 2.19.1.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
                   ` (6 preceding siblings ...)
  2018-11-22  6:14 ` [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Gao, Liming
@ 2018-11-22 16:12 ` Laszlo Ersek
  7 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-22 16:12 UTC (permalink / raw)
  To: Fu Siyuan
  Cc: edk2-devel, Ruiyu Ni, Ting Ye, Jordan Justen, Hao Wu, Jiaxin Wu,
	Anthony Perard, David Wei

On 11/22/18 06:21, Fu Siyuan wrote:
> There is a patch to remove the redudant IP4 only iSCSI/PXE/TCP drivers
> from MdeModulePkg, which has been reviewed before edk2-stable201811 tag.
> And we also have plan to move all network related libraries/modules to
> NetworkPkg. In order to make these change more smoothly, a set of fragment
> files (2 for DSC and 1 for FDF) are provided for platform to enable the 
> network stack support, without directly reference the INF module path.
> 
> Patch 1/6 adds centralized dsc/fdf include files to NetworkPkg, with
> a set of flags for feature set enable/disable.
> Patch 2~6 updates edk2 platform dsc/fdf files to use the new include
> files, instead of reference the module INF.
> 
> v2:
>   1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
>   file. This could provide more flexibility to platform owner to use the
>   include files.
>   2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
>   3. Use "!error" statement for incorrect flag value check.
>   4. Update platform DSC/FDF to use the new include files.
>   5. Other decoration work according to Laszlo's comments.

Thanks for v2! I'll need a bit more time for reviewing it. Also it seems
we'll have to come to an agreement with Liming and Ray first. So let's
continue those sub-threads on the design ideas before I start my full v2
review round.

Thanks for your patience,
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
  2018-11-22  9:56   ` Ni, Ruiyu
@ 2018-11-23 10:56   ` Laszlo Ersek
  2018-12-10  8:36     ` Ard Biesheuvel
  1 sibling, 1 reply; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 10:56 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel
  Cc: Ting Ye, Jiaxin Wu, Ard Biesheuvel,
	Leif Lindholm (Linaro address)

+Ard, +Leif

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch provides a set of include segment files for platform owner to
> easily enable/disable network stack support on their platform.
> 
> For DSC, there are:
> - a "NetworkDefines.dsc.inc" for the [Defines] section(s),
> - a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
> - a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
> - a "NetworkComponents.dsc.inc" for the [Components*] section(s).
> For FDF, there is:
> - a "Network.fdf.inc" for the [Fv*] section(s).
> 
> These files can be added to the platform DSC/FDF file by using
>   !include NetworkPkg/xxx
> where "xxx" is the *.inc file name.
> 
> A set of flags can be changed before the include line or in build command
> line ("-D FLAG=VALUE") to enable or disable related feature set, please
> check "NetworkDefines.dsc.inc" for a detail description of each flag.
> 
> The default value of these flags are:
>   DEFINE NETWORK_ENABLE                 = TRUE
>   DEFINE NETWORK_SNP_ENABLE             = TRUE
>   DEFINE NETWORK_IP4_ENABLE             = TRUE
>   DEFINE NETWORK_IP6_ENABLE             = TRUE
>   DEFINE NETWORK_TLS_ENABLE             = TRUE
>   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
>   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
>   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
>   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
>   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> 
> Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293
> 
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Ting Ye <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
> 
> Notes:
>     v2:
>     1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
>     file. This could provide more flexibility to platform owner to use the
>     include files.
>     2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
>     3. Use "!error" statement for incorrect flag value check.
>     4. Other decoration work according to Laszlo's comments.
> 
>  NetworkPkg/Network.fdf.inc           |  69 ++++++++++
>  NetworkPkg/NetworkComponents.dsc.inc |  71 ++++++++++
>  NetworkPkg/NetworkDefines.dsc.inc    | 138 ++++++++++++++++++++
>  NetworkPkg/NetworkLibs.dsc.inc       |  25 ++++
>  NetworkPkg/NetworkPcds.dsc.inc       |  22 ++++
>  NetworkPkg/NetworkPkg.dsc            |  28 +---
>  6 files changed, 331 insertions(+), 22 deletions(-)
> 
> diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc
> new file mode 100644
> index 000000000000..abd4c6c363d5
> --- /dev/null
> +++ b/NetworkPkg/Network.fdf.inc
> @@ -0,0 +1,69 @@
> +## @file
> +# Network FDF include file for All Architectures.
> +#
> +# This file can be included to a platform FDF by using "!include NetworkPkg/Network.fdf.inc"
> +# to add EDKII network stack drivers according to the value of flags described in
> +# "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +
> +!if $(NETWORK_ENABLE) == TRUE
> +  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> +
> +  !if $(NETWORK_SNP_ENABLE) == TRUE
> +    INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> +    INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> +  !endif
> +
> +  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +
> +  !if $(NETWORK_IP4_ENABLE) == TRUE
> +    INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> +    INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> +    INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IP6_ENABLE) == TRUE
> +    INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> +    INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> +    INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> +    INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> +  !endif
> +
> +  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> +  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> +
> +  !if $(NETWORK_TLS_ENABLE) == TRUE
> +    INF  NetworkPkg/TlsDxe/TlsDxe.inf
> +    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> +    INF  NetworkPkg/DnsDxe/DnsDxe.inf
> +    INF  NetworkPkg/HttpDxe/HttpDxe.inf
> +    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> +    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> +    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> +    INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
> +  !endif
> +!endif

This part looks good!

> diff --git a/NetworkPkg/NetworkComponents.dsc.inc b/NetworkPkg/NetworkComponents.dsc.inc
> new file mode 100644
> index 000000000000..8074489b8e06
> --- /dev/null
> +++ b/NetworkPkg/NetworkComponents.dsc.inc
> @@ -0,0 +1,71 @@
> +## @file
> +# Network DSC include file for [Components*] section of all Architectures.
> +#
> +# This file can be included to the [Components*] section(s) of a platform DSC file
> +# by using "!include NetworkPkg/NetworkComponents.dsc.inc" to specify the INF files
> +# of EDKII network drivers according to the value of flags described in
> +# "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!if $(NETWORK_ENABLE) == TRUE
> +  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> +
> +  !if $(NETWORK_SNP_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> +  !endif
> +
> +  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> +
> +  !if $(NETWORK_IP4_ENABLE) == TRUE
> +    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> +    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> +    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> +    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> +    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IP6_ENABLE) == TRUE
> +    NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> +    NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> +    NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> +    NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> +  !endif
> +
> +  NetworkPkg/TcpDxe/TcpDxe.inf
> +  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> +
> +  !if $(NETWORK_TLS_ENABLE) == TRUE
> +    NetworkPkg/TlsDxe/TlsDxe.inf
> +    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> +    NetworkPkg/DnsDxe/DnsDxe.inf
> +    NetworkPkg/HttpDxe/HttpDxe.inf
> +    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> +    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> +    NetworkPkg/IScsiDxe/IScsiDxe.inf
> +  !endif
> +
> +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> +    NetworkPkg/IpSecDxe/IpSecDxe.inf
> +  !endif
> +!endif

This also looks great; it matches the order & formatting of the FDF
include file too.

> diff --git a/NetworkPkg/NetworkDefines.dsc.inc b/NetworkPkg/NetworkDefines.dsc.inc
> new file mode 100644
> index 000000000000..648c065baadb
> --- /dev/null
> +++ b/NetworkPkg/NetworkDefines.dsc.inc
> @@ -0,0 +1,138 @@
> +## @file
> +# Network DSC include file for [Defines] section of all Architectures.
> +#
> +# This file can be included to the [Defines] section of a platform DSC file by
> +# using "!include NetworkPkg/NetworkDefines.dsc.inc" to set default value of
> +# flags if they are not defined somewhere else, and also check the value to see
> +# if there is any conflict.
> +#
> +# These flags can be defined before the !include line, or changed on the command
> +# line to enable or disable related feature support.
> +#   -D FLAG=VALUE
> +# The default value of these flags are:
> +#   DEFINE NETWORK_ENABLE                 = TRUE
> +#   DEFINE NETWORK_SNP_ENABLE             = TRUE
> +#   DEFINE NETWORK_IP4_ENABLE             = TRUE
> +#   DEFINE NETWORK_IP6_ENABLE             = TRUE
> +#   DEFINE NETWORK_TLS_ENABLE             = TRUE
> +#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> +#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> +#   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> +#   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> +#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> +#
> +# Copyright (c) 2018, 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 text of the license may be found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!ifndef NETWORK_ENABLE
> +  #
> +  # This flag is to enable or disable the whole network stack.
> +  #
> +  DEFINE NETWORK_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_SNP_ENABLE
> +  #
> +  # This flag is to include the common SNP driver or not.
> +  #
> +  DEFINE NETWORK_SNP_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_VLAN_ENABLE
> +  #
> +  # This flag is to enable or disable VLAN feature.
> +  #
> +  DEFINE NETWORK_VLAN_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_IP4_ENABLE
> +  #
> +  # This flag is to enable or disable IPv4 network stack.
> +  #
> +  DEFINE NETWORK_IP4_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_IP6_ENABLE
> +  #
> +  # This flag is to enable or disable IPv6 network stack.
> +  #
> +  DEFINE NETWORK_IP6_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_TLS_ENABLE
> +  #
> +  # This flag is to enable or disable TLS feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       The OpensslLib.inf library instance should be used since libssl is required.
> +  #
> +  DEFINE NETWORK_TLS_ENABLE = TRUE
> +!endif

Nice, thanks!

> +
> +!ifndef NETWORK_HTTP_BOOT_ENABLE
> +  #
> +  # This flag is to enable or disable HTTP(S) boot feature.
> +  #
> +  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
> +!endif
> +
> +!ifndef NETWORK_ALLOW_HTTP_CONNECTIONS
> +  #
> +  # Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
> +  #
> +  # Note: If NETWORK_ALLOW_HTTP_CONNECTIONS is TRUE, HTTP connections are allowed.
> +  #       Both the "https://" and "http://" URI schemes are permitted. Otherwise, HTTP
> +  #       connections are denied. Only the "https://" URI scheme is permitted.
> +  #
> +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> +!endif
> +
> +!ifndef NETWORK_ISCSI_ENABLE
> +  #
> +  # This flag is to enable or disable iSCSI feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
> +  #       since libssl is not required for iSCSI.
> +  #
> +  DEFINE NETWORK_ISCSI_ENABLE = TRUE
> +!endif

Very clear. Great.

> +
> +!ifndef NETWORK_IPSEC_ENABLE
> +  #
> +  # This flag is to enable or disable IPsec feature.
> +  #
> +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
> +  #       since libssl is not required for IPsec.
> +  #
> +  DEFINE NETWORK_IPSEC_ENABLE = TRUE
> +!endif
> +

Ditto.

One request for this file, at a higher level:

(1) The order of the default settings in this file *almost* matches the
order of the flags in the summary, at the top -- but not completely. Can
you please reorder the defaults so they match the summary? Basically:
- move the NETWORK_ISCSI_ENABLE to the end,
- then move NETWORK_VLAN_ENABLE to the end (after NETWORK_ISCSI_ENABLE).

That should restore the right order.

> +!if $(NETWORK_ENABLE) == TRUE
> +  #
> +  # Check the flags to see if there is any conflict.
> +  #
> +  !if ($(NETWORK_IP4_ENABLE) == FALSE) AND ($(NETWORK_IP6_ENABLE) == FALSE)
> +    !error "Must enable at least IP4 or IP6 stack if NETWORK_ENABLE is set to TRUE!"
> +  !endif
> +
> +  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND ($(NETWORK_TLS_ENABLE) == FALSE) AND ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
> +    !error "Must enable TLS to support HTTPS, or allow unsecured HTTP connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
> +  !endif
> +!endif

Nice.

> diff --git a/NetworkPkg/NetworkLibs.dsc.inc b/NetworkPkg/NetworkLibs.dsc.inc
> new file mode 100644
> index 000000000000..67d09c262074
> --- /dev/null
> +++ b/NetworkPkg/NetworkLibs.dsc.inc
> @@ -0,0 +1,25 @@
> +## @file
> +# Network DSC include file for [LibraryClasses*] section of all Architectures.
> +#
> +# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
> +# by using "!include NetworkPkg/NetworkLibs.dsc.inc" to specify the library instances
> +# of EDKII network library classes.
> +#
> +# Copyright (c) 2018, 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 text of the license may be found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +##
> +
> +  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> +  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> +  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> +  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> +  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf

In theory, it would be possible to wrap this part into a NETWORK_ENABLE
condition, and then resolve some of the library classes conditional on
further flags, such as HttpLib dependent on NETWORK_HTTP_BOOT_ENABLE.

However:

- these library instances are not meant to be replaced by other libary
instances, when a platform needs the library classes for any purpose
(i.e., these are single-instance lib classes),

- and even if the platform doesn't need some (or all) of these lib
classes, resolving them does no harm (negligible performance impact).

So I agree to keep this part simple.

> diff --git a/NetworkPkg/NetworkPcds.dsc.inc b/NetworkPkg/NetworkPcds.dsc.inc
> new file mode 100644
> index 000000000000..3eee5b3ae0bf
> --- /dev/null
> +++ b/NetworkPkg/NetworkPcds.dsc.inc
> @@ -0,0 +1,22 @@
> +## @file
> +# Network DSC include file for [Pcds*] section of all Architectures.
> +#
> +# This file can be included to the [Pcds*] section(s) of a platform DSC file
> +# by using "!include NetworkPkg/NetworkPcds.dsc.inc" to specify PCD settings
> +# according to the value of flags described in "NetworkDefines.dsc.inc".
> +#
> +# Copyright (c) 2018, 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 text of the license may be found at
> +#    http://opensource.org/licenses/bsd-license.php
> +#
> +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +##
> +
> +!if $(NETWORK_ALLOW_HTTP_CONNECTIONS) == TRUE
> +  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> +!endif

(2) Looks good, but I think the PCD setting should be restricted
*additionally* to NETWORK_ENABLE && NETWORK_HTTP_BOOT_ENABLE.

> diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
> index b543caa08fb1..654f73785054 100644
> --- a/NetworkPkg/NetworkPkg.dsc
> +++ b/NetworkPkg/NetworkPkg.dsc
> @@ -24,6 +24,8 @@ [Defines]
>    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>    SKUID_IDENTIFIER               = DEFAULT
>  
> +!include NetworkPkg/NetworkDefines.dsc.inc
> +
>  [LibraryClasses]
>    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> @@ -47,12 +49,8 @@ [LibraryClasses]
>    DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
>    SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
>  
> -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> +!include NetworkPkg/NetworkLibs.dsc.inc
> +
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> @@ -86,6 +84,7 @@ [PcdsFeatureFlag]
>  [PcdsFixedAtBuild]
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
> +!include NetworkPkg/NetworkPcds.dsc.inc
>  
>  ###################################################################################################
>  #
> @@ -107,25 +106,10 @@ [PcdsFixedAtBuild]
>  ###################################################################################################
>  
>  [Components]
> -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  NetworkPkg/TcpDxe/TcpDxe.inf
> -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -  NetworkPkg/DnsDxe/DnsDxe.inf
> -  NetworkPkg/HttpDxe/HttpDxe.inf
> -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> +!include NetworkPkg/NetworkComponents.dsc.inc
>  
>    NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
>    NetworkPkg/Application/VConfig/VConfig.inf
>  
> -[Components.IA32, Components.X64]
> -  NetworkPkg/IpSecDxe/IpSecDxe.inf
> -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  NetworkPkg/TlsDxe/TlsDxe.inf
> -  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> -
>  [BuildOptions]
>    *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> 

This part makes me curious. :)

It's good that the defaults for the new build flags ensure that
NetworkPkg.dsc's coverage not shrink -- everything that used to be built
by default continues to be built by default. However:

(3) This change will build IpSecDxe, IScsiDxe, UefiPxeBcDxe, TlsDxe and
TlsAuthConfigDxe on ARM and AARCH64 as well. I actually welcome that,
but that's a functional change, and so it should be a separate patch.

Namely, please *prepend* a patch to the series that simply deletes the
"[Components.IA32, Components.X64]" line, bringing all these drivers to
ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
separately (simply by test-building it), then the current patch can
simply replace the component list with the !include directive -- and
such a replacement won't incur arch-specific changes.

(4) I'm noticing there are two applications too. Should we move them to
"NetworkApps.dsc.inc" and "NetworkApps.fdf.inc", perhaps?

And in those include files, the individual apps would be gated by
NETWORK_ENABLE, plus NETWORK_IPSEC_ENABLE / NETWORK_VLAN_ENABLE.

This is a tricky question, so I don't mind if we solve it later, or
don't solve it at all. It is tricky because:

- Even if a platform builds these features into the platform firmware,
it might not want to offer these applications -- and then we shouldn't
even build the applications. Therefore, we shouldn't simply move the
applications to the components include file. Hence "NetworkApps.dsc.inc".

- Assuming a platform *does* want to offer these applications (and hence
builds them through the suggested "NetworkApps.dsc.inc"), the apps could
be offered in a different firmware volume, or even on external
(remvoable) media. That means that we shouldn't simply add the apps to
the FDF include file. Hence "NetworkApps.fdf.inc".

Anyway, this is just my curiosity. :)


In summary, I would be OK with you fixing up (1) and (2) on push (and I
considered givig my R-b on that condition, in advance). And, I'm fine
ignoring (4) totally at the moment. However, for (3), I'd really like if
we could build-test that change in separation. And then the next version
(v3) of this specific patch would be totally architecture-independent.

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 5/6] OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
@ 2018-11-23 12:00   ` Laszlo Ersek
  2018-11-23 12:10   ` Laszlo Ersek
  2018-11-23 12:19   ` Laszlo Ersek
  2 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 12:00 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel; +Cc: Anthony Perard, Jordan Justen

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch updates the platform DSC/FDF files to use the include fragment
> files provided by NetworkPkg.
> The feature enabling flags in [Defines] section have been updated to use
> the NetworkPkg's terms, and the value has been overridden with the original
> default value on this platform.
>
> This patch also rename the TLS_ENABLE flag to PLATFORM_TLS_ENABLE for the
> platform specific configuration for TLS support.
>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>
> Notes:
>     v2:
>     Rename TLS_ENABLE flag to PLATFORM_TLS_ENABLE flag for platform specific configuration for TLS support.
>
>  OvmfPkg/OvmfPkgIa32.dsc    | 75 +++++++++----------
>  OvmfPkg/OvmfPkgIa32.fdf    | 27 +------
>  OvmfPkg/OvmfPkgIa32X64.dsc | 76 +++++++++-----------
>  OvmfPkg/OvmfPkgIa32X64.fdf | 27 +------
>  OvmfPkg/OvmfPkgX64.dsc     | 75 +++++++++----------
>  OvmfPkg/OvmfPkgX64.fdf     | 27 +------
>  6 files changed, 102 insertions(+), 205 deletions(-)
>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index eccf34d3d1cb..adedd2240a8a 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -35,12 +35,25 @@ [Defines]
>    # -D FLAG=VALUE
>    #
>    DEFINE SECURE_BOOT_ENABLE      = FALSE
> -  DEFINE NETWORK_IP6_ENABLE      = FALSE
> -  DEFINE HTTP_BOOT_ENABLE        = FALSE
>    DEFINE SMM_REQUIRE             = FALSE
> -  DEFINE TLS_ENABLE              = FALSE
>    DEFINE TPM2_ENABLE             = FALSE
>
> +  #
> +  # PLATFORM_TLS_ENABLE flag is used to control platform specific configuration for TLS support,
> +  # which add a NULL class library instance to TlsAuthConfigDxe.inf for downloading the necessary
> +  # data from QEMU via fw_cfg.
> +  #
> +  DEFINE PLATFORM_TLS_ENABLE            = FALSE
> +  #
> +  # The NETWORK_TLS_ENABLE should always be set to FALSE since PLATFORM_TLS_ENABLE is used.
> +  #
> +  DEFINE NETWORK_TLS_ENABLE             = FALSE
> +  DEFINE NETWORK_IP6_ENABLE             = FALSE
> +  DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
> +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
> +  DEFINE NETWORK_IPSEC_ENABLE           = FALSE
> +!include NetworkPkg/NetworkDefines.dsc.inc
> +

Perfect. Logically, this is exactly right.

One syntactic request:

(1) Can you please rewrap the -- otherwise spot-on -- explanation of
PLATFORM_TLS_ENABLE to 80 characters? Same for the NETWORK_TLS_ENABLE
explanation.

>    #
>    # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
>    # one of the supported values, in place of any of the convenience macros, is
> @@ -144,10 +157,6 @@ [LibraryClasses]
>    FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>    UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>    SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
>    UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>    SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
>    QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
> @@ -173,7 +182,7 @@ [LibraryClasses]
>    DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
>    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> -!if $(TLS_ENABLE) == TRUE
> +!if $(PLATFORM_TLS_ENABLE) == TRUE
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>  !else
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> @@ -191,11 +200,12 @@ [LibraryClasses]
>
>    TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf

(2) Please remove the TcpIoLib resolution as well. It is provided by
"NetworkPkg/NetworkLibs.dsc.inc".

>
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> -!endif
> +  #
> +  # Network libraries
> +  #
> +!include NetworkPkg/NetworkLibs.dsc.inc
>
> -!if $(TLS_ENABLE) == TRUE
> +!if $(PLATFORM_TLS_ENABLE) == TRUE
>    TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
>  !endif
>
> @@ -442,7 +452,7 @@ [PcdsFixedAtBuild]
>  !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> -!if $(TLS_ENABLE) == FALSE
> +!if $(PLATFORM_TLS_ENABLE) == FALSE
>    # match PcdFlashNvStorageVariableSize purely for convenience
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
>  !endif
> @@ -450,12 +460,12 @@ [PcdsFixedAtBuild]
>  !if $(FD_SIZE_IN_KB) == 4096
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400
> -!if $(TLS_ENABLE) == FALSE
> +!if $(PLATFORM_TLS_ENABLE) == FALSE
>    # match PcdFlashNvStorageVariableSize purely for convenience
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000
>  !endif
>  !endif
> -!if $(TLS_ENABLE) == TRUE
> +!if $(PLATFORM_TLS_ENABLE) == TRUE
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
>  !endif
> @@ -504,9 +514,10 @@ [PcdsFixedAtBuild]
>    gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
>  !endif
>
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> -!endif
> +  #
> +  # Network Pcds
> +  #
> +!include NetworkPkg/NetworkPcds.dsc.inc
>
>    gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
>
> @@ -777,31 +788,9 @@ [Components]
>    #
>    # Network Support
>    #
> -  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> -  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> -  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> -  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> -  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> -  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> -  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  NetworkPkg/TcpDxe/TcpDxe.inf
> -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  NetworkPkg/DnsDxe/DnsDxe.inf
> -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  NetworkPkg/HttpDxe/HttpDxe.inf
> -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> -!endif
> -!if $(TLS_ENABLE) == TRUE
> +!include NetworkPkg/NetworkComponents.dsc.inc
> +
> +!if $(PLATFORM_TLS_ENABLE) == TRUE
>    NetworkPkg/TlsDxe/TlsDxe.inf
>    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
>      <LibraryClasses>

(3) This is all great. What do you think of the following, in addition:
(and this is actually another comment for the NetworkPkg patch:)

We could introduce another include file, namely

  NetworkPkg/NetworkShellCommandsLib.dsc.inc

And in that file, you could provide:

  !if NETWORK_ENABLE
    !if NETWORK_IP4_ENABLE
      NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
    !endif
    !if NETWORK_IP6_ENABLE
      NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
    !endif
  !endif

Because, with the help of this file, we could retire the last remaining
instance of NETWORK_IP6_ENABLE in the OVMF DSC files:

  !if $(NETWORK_IP6_ENABLE) == TRUE
        NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
  !endif

What's your opinion?

> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index f7f9ab06bb5a..995328992ccf 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf
> @@ -296,31 +296,8 @@ [FV.DXEFV]
>  #
>  # Network modules
>  #
> -  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> -  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> -  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> -  INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> -  INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> -  INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> -  INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> -  INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> -  INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> -  INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  INF  NetworkPkg/DnsDxe/DnsDxe.inf
> -  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  INF  NetworkPkg/HttpDxe/HttpDxe.inf
> -  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> -!endif
> -!if $(TLS_ENABLE) == TRUE
> +!include NetworkPkg/Network.fdf.inc
> +!if $(PLATFORM_TLS_ENABLE) == TRUE
>    INF  NetworkPkg/TlsDxe/TlsDxe.inf
>    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
>  !endif

Nice.

Last request for the OvmfPkg patch:

(4) Please replace HTTP_BOOT_ENABLE and TLS_ENABLE in the "OvmfPkg/README"
file as well (there is one hit for each build flag).

Please also re-wrap any lines in the README that grow longer than 80
characters, due to the replacements.

(Regarding the Wiki, I've just filed
<https://bugzilla.tianocore.org/show_bug.cgi?id=1357> separately.)

I'm real happy about this series. :)

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 5/6] OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
  2018-11-23 12:00   ` Laszlo Ersek
@ 2018-11-23 12:10   ` Laszlo Ersek
  2018-11-23 12:19   ` Laszlo Ersek
  2 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 12:10 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel; +Cc: Anthony Perard, Jordan Justen

Another comment for this patch:

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch updates the platform DSC/FDF files to use the include fragment
> files provided by NetworkPkg.
> The feature enabling flags in [Defines] section have been updated to use
> the NetworkPkg's terms, and the value has been overridden with the original
> default value on this platform.
> 
> This patch also rename the TLS_ENABLE flag to PLATFORM_TLS_ENABLE for the
> platform specific configuration for TLS support.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
> 
> Notes:
>     v2:
>     Rename TLS_ENABLE flag to PLATFORM_TLS_ENABLE flag for platform specific configuration for TLS support.
> 
>  OvmfPkg/OvmfPkgIa32.dsc    | 75 +++++++++----------
>  OvmfPkg/OvmfPkgIa32.fdf    | 27 +------
>  OvmfPkg/OvmfPkgIa32X64.dsc | 76 +++++++++-----------
>  OvmfPkg/OvmfPkgIa32X64.fdf | 27 +------
>  OvmfPkg/OvmfPkgX64.dsc     | 75 +++++++++----------
>  OvmfPkg/OvmfPkgX64.fdf     | 27 +------
>  6 files changed, 102 insertions(+), 205 deletions(-)

It catches my eye that the IA32X64 dsc file has a different "changed
line count" from the others (76 vs. 75). And, indeed, there is a bug:

> diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> index f7f9ab06bb5a..995328992ccf 100644
> --- a/OvmfPkg/OvmfPkgIa32.fdf
> +++ b/OvmfPkg/OvmfPkgIa32.fdf

> @@ -509,10 +519,10 @@ [PcdsFixedAtBuild]
>    gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
>  !endif
>  
> -[PcdsFixedAtBuild.X64]
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> -!endif
> +  #
> +  # Network Pcds
> +  #
> +!include NetworkPkg/NetworkPcds.dsc.inc
>  
>    gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
>  

(5) Please do not remove the [PcdsFixedAtBuild.X64] section header.

Thanks,
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 5/6] OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
  2018-11-23 12:00   ` Laszlo Ersek
  2018-11-23 12:10   ` Laszlo Ersek
@ 2018-11-23 12:19   ` Laszlo Ersek
  2 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 12:19 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel
  Cc: Jordan Justen, Ard Biesheuvel, Anthony Perard, Julien Grall

Yet another comment:

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch updates the platform DSC/FDF files to use the include fragment
> files provided by NetworkPkg.
> The feature enabling flags in [Defines] section have been updated to use
> the NetworkPkg's terms, and the value has been overridden with the original
> default value on this platform.
> 
> This patch also rename the TLS_ENABLE flag to PLATFORM_TLS_ENABLE for the
> platform specific configuration for TLS support.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
> 
> Notes:
>     v2:
>     Rename TLS_ENABLE flag to PLATFORM_TLS_ENABLE flag for platform specific configuration for TLS support.

(6) Please reference
<https://bugzilla.tianocore.org/show_bug.cgi?id=1293> in the commit message.

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/6] ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 ` [PATCH v2 3/6] ArmVirtPkg: " Fu Siyuan
@ 2018-11-23 12:29   ` Laszlo Ersek
  2018-11-23 12:30     ` Laszlo Ersek
  2018-11-23 16:50   ` Laszlo Ersek
  1 sibling, 1 reply; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 12:29 UTC (permalink / raw)
  To: Fu Siyuan; +Cc: edk2-devel, Ard Biesheuvel

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch updates the platform DSC/FDF files to use the include fragment
> files provided by NetworkPkg.
> The feature enabling flags in [Defines] section have been updated to use
> the NetworkPkg's terms, and the value has been overridden with the original
> default value on this platform.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Julien Grall <julien.grall@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc           | 11 +----
>  ArmVirtPkg/ArmVirtQemu.dsc           | 46 ++++++--------------
>  ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 28 +-----------
>  ArmVirtPkg/ArmVirtQemuKernel.dsc     | 46 ++++++--------------
>  4 files changed, 28 insertions(+), 103 deletions(-)

(1) Please reference
<https://bugzilla.tianocore.org/show_bug.cgi?id=1293> in the commit message.

> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 70a0ac4d786c..d7de73a88eff 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -76,16 +76,7 @@ [LibraryClasses.common]
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
>  
>    # Networking Requirements
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> -!endif
> +!include NetworkPkg/NetworkLibs.dsc.inc
>  
>    #
>    # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index 885c6b14b844..1414b6a5ccf8 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -33,9 +33,14 @@ [Defines]
>    # Defines for default states.  These can be changed on the command line.
>    # -D FLAG=VALUE
>    #
> -  DEFINE SECURE_BOOT_ENABLE      = FALSE
> -  DEFINE NETWORK_IP6_ENABLE      = FALSE
> -  DEFINE HTTP_BOOT_ENABLE        = FALSE
> +  DEFINE SECURE_BOOT_ENABLE              = FALSE
> +  DEFINE NETWORK_IP6_ENABLE              = FALSE
> +  DEFINE NETWORK_HTTP_BOOT_ENABLE        = FALSE
> +  DEFINE NETWORK_SNP_ENABLE              = FALSE
> +  DEFINE NETWORK_TLS_ENABLE              = FALSE
> +  DEFINE NETWORK_IPSEC_ENABLE            = FALSE
> +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS  = TRUE
> +!include NetworkPkg/NetworkDefines.dsc.inc
>  
>  !include ArmVirtPkg/ArmVirt.dsc.inc
>  

This is correct.

> @@ -123,9 +128,10 @@ [PcdsFixedAtBuild.common]
>    #
>    gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
>  
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> -!endif
> +  #
> +  # Network Pcds
> +  #
> +!include NetworkPkg/NetworkPcds.dsc.inc
>  
>    # System Memory Base -- fixed at 0x4000_0000
>    gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> @@ -338,33 +344,7 @@ [Components.common]
>    #
>    # Networking stack
>    #
> -  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> -  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> -  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> -  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> -  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> -  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  NetworkPkg/TcpDxe/TcpDxe.inf
> -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -!else
> -  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
> -  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  NetworkPkg/DnsDxe/DnsDxe.inf
> -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  NetworkPkg/HttpDxe/HttpDxe.inf
> -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> -!endif
> +!include NetworkPkg/NetworkComponents.dsc.inc
>  
>    #
>    # SCSI Bus and Disk Driver

(2) This is good, and the end result that we want; however, it does two
things at once -- it eliminates the MdeModulePkg network drivers, and it
adopts the NetworkPkg includes.

In OvmfPkg, we handled the first step separately, in commit d2f1f6423bd1
("OvmfPkg: Replace obsoleted network drivers from platform DSC/FDF.",
2018-11-06).

I'm not proposing that we separate out the same change for ArmVirtPkg as
well. After all, we can consider the current patch as a *means* to
implementing the same -- just better. So, what I propose is, please add
the following to the commit message:

    This change automatically ports OvmfPkg commit d2f1f6423bd1
    ("OvmfPkg: Replace obsoleted network drivers from platform
    DSC/FDF.", 2018-11-06) to NetworkPkg.

> diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> index a6390bd4b841..560651e49e0b 100644
> --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> @@ -118,33 +118,7 @@ [FV.FvMain]
>    #
>    # Networking stack
>    #
> -  INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> -  INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> -  INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> -  INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> -  INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> -  INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> -  INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> -  INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  INF NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  INF NetworkPkg/TcpDxe/TcpDxe.inf
> -  INF NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  INF NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  INF NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -  INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  INF NetworkPkg/IScsiDxe/IScsiDxe.inf
> -!else
> -  INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
> -  INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  INF NetworkPkg/DnsDxe/DnsDxe.inf
> -  INF NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  INF NetworkPkg/HttpDxe/HttpDxe.inf
> -  INF NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> -!endif
> +!include NetworkPkg/Network.fdf.inc
>  
>    #
>    # SCSI Bus and Disk Driver

Looks OK.

> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index 434d6861a56f..e1f5dd3f0df2 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -33,9 +33,14 @@ [Defines]
>    # Defines for default states.  These can be changed on the command line.
>    # -D FLAG=VALUE
>    #
> -  DEFINE SECURE_BOOT_ENABLE      = FALSE
> -  DEFINE NETWORK_IP6_ENABLE      = FALSE
> -  DEFINE HTTP_BOOT_ENABLE        = FALSE
> +  DEFINE SECURE_BOOT_ENABLE              = FALSE
> +  DEFINE NETWORK_IP6_ENABLE              = FALSE
> +  DEFINE NETWORK_HTTP_BOOT_ENABLE        = FALSE
> +  DEFINE NETWORK_SNP_ENABLE              = FALSE
> +  DEFINE NETWORK_TLS_ENABLE              = FALSE
> +  DEFINE NETWORK_IPSEC_ENABLE            = FALSE
> +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS  = TRUE
> +!include NetworkPkg/NetworkDefines.dsc.inc
>  
>  !include ArmVirtPkg/ArmVirt.dsc.inc
>  
> @@ -126,9 +131,10 @@ [PcdsFixedAtBuild.common]
>    #
>    gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
>  
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> -!endif
> +  #
> +  # Network Pcds
> +  #
> +!include NetworkPkg/NetworkPcds.dsc.inc
>  
>  [PcdsPatchableInModule.common]
>    #
> @@ -327,33 +333,7 @@ [Components.common]
>    #
>    # Networking stack
>    #
> -  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> -  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> -  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> -  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> -  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> -  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> -  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> -  NetworkPkg/TcpDxe/TcpDxe.inf
> -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> -!else
> -  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
> -  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
> -  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  NetworkPkg/DnsDxe/DnsDxe.inf
> -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> -  NetworkPkg/HttpDxe/HttpDxe.inf
> -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> -!endif
> +!include NetworkPkg/NetworkComponents.dsc.inc
>  
>    #
>    # SCSI Bus and Disk Driver
> 

With the commit message updates as requested in (1) and (2):

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/6] ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-23 12:29   ` Laszlo Ersek
@ 2018-11-23 12:30     ` Laszlo Ersek
  0 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 12:30 UTC (permalink / raw)
  To: Fu Siyuan; +Cc: edk2-devel, Ard Biesheuvel

On 11/23/18 13:29, Laszlo Ersek wrote:

> (2) This is good, and the end result that we want; however, it does two
> things at once -- it eliminates the MdeModulePkg network drivers, and it
> adopts the NetworkPkg includes.
> 
> In OvmfPkg, we handled the first step separately, in commit d2f1f6423bd1
> ("OvmfPkg: Replace obsoleted network drivers from platform DSC/FDF.",
> 2018-11-06).
> 
> I'm not proposing that we separate out the same change for ArmVirtPkg as
> well. After all, we can consider the current patch as a *means* to
> implementing the same -- just better. So, what I propose is, please add
> the following to the commit message:
> 
>     This change automatically ports OvmfPkg commit d2f1f6423bd1
>     ("OvmfPkg: Replace obsoleted network drivers from platform
>     DSC/FDF.", 2018-11-06) to NetworkPkg.

Argh, obviously, I meant "... to ArmVirtPkg". :)

Thanks,
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-22 15:48   ` Laszlo Ersek
@ 2018-11-23 16:02     ` Gao, Liming
  2018-11-23 18:35       ` Laszlo Ersek
  0 siblings, 1 reply; 26+ messages in thread
From: Gao, Liming @ 2018-11-23 16:02 UTC (permalink / raw)
  To: 'Laszlo Ersek', Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Wei, David, Gao, Liming

Laszlo:
  I add my comments. 

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Thursday, November 22, 2018 11:48 PM
> To: Gao, Liming <liming.gao@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>; Wei, David
> <david.wei@intel.com>
> Subject: Re: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
> 
> On 11/22/18 07:14, Gao, Liming wrote:
> > Siyuan:
> >   Thanks for your contribution. I really like this idea to share the
> >   common DSC/FDF between all platform DSC/FDFs.  Now, FixedAtBuild PCD
> >   can also be used in the conditional statement. Its value can be
> >   specified by build command with --pcd option. So, I suggest to use
> >   FixedAtBuild PCD for network feature instead of MACRO. I would like
> >   to recommend to use PCD both for the build and firmware
> >   configuration. For this case, one UINT16 FixedAtBuildPcd can be
> >   introduced in NetworkPkg.dec.  Its different bit will be for the
> >   different network features. Below is the example.
> 
> I disagree.
> 
> A bitmask is a very good representation for *computers*, to handle a set
> of features. On the other hand, a bitmask is a catastrophically bad
> representation for *humans*, when they are trying to configure a
> platform build (that is, writing a build command line), selecting the
> firmware features they want. It is hard to compute, and it is extremely
> hard to grep for.
> 
> It is trivial to grep a build script for "NETWORK_TLS_ENABLE". It is
> much harder to grep the same script for PcdNetworkFeatureMask, and then
> check whether bit#4 is set in the value.
If BitMask is not good for this case, BOOLEAN type FixedAtBuildPcd can be defined to match current macro one by one. 
For example, gEfiNetworkPkgTokenSpaceGuid.PcdNetworkEnable is added to map macro NETWORK_ENABLE.

> 
> > Besides, I think *.dsc.inc files need to include section header. If
> > so, *.dsc.inc is the standalone dsc file. It can easily be included in
> > platform DSC file.
> 
> I disagree. For a platform, spelling out the section header is not a big
> burden, but it provides a lot of flexibility. For example, it can
> restrict the scope of the included text (e.g., component list) to a
> specific architecture only. For another example, the platform's section
> header can specify the flavor of the PCDs for which the included text
> provides the default values (fixed PCD, patchable PCD, even dynamic(ex)
> PCD).
> 
> Standalone DSC file is the wrong thing to aim for, in this instance --
> in my opinion anyway. Yes, it appears simpler, but it loses too much
> flexibility. In my earlier comments I pointed out that the "allow
> plaintext HTTP connections" PCD was declared in NetworkPkg.dec as either
> fixed or patchable. The dsc.inc file should not squander that
> flexibility and dictate fixed only.
This is not TRUE. Dynamic PCD has the different value format, such as DynamicHii PCD. 
Without section header, DynamicHii PCD can't be specified together with FixedAtBuild Pcd.
Package level *.pcd.inc provides the recommended type and setting. 
Platform can override Pcd value and type In their DSC file. BaseTools supports PCD value override, 
doesn't support PCD type override. This can be supported. 

> 
> > Especially for library instance, the different library instance may be
> > for the different module type. Without section header, they can be
> > placed into one *Libs.dsc.inc file.
> 
> Ugh... I'm now condfused. Now it seems that you and I are asking for the
> same thing actually. Did you perhaps mean, above, that "*.dsc.inc files
> need *NOT* include section header"?
> 
I miss not. I mean without section header, they can't be placed into one *Libs.dsc.inc file.
Below is one example. One Libs.dsc.inc can list the different library instance for the different module type.

[LibraryClasses]
  TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
[LibraryClasses.common.SEC]
  TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
  TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf

> > [Defines]
> >    DEFINE NETWORK_ENABLE                 = 0x1
> >    DEFINE NETWORK_SNP_ENABLE             = 0x2
> >    DEFINE NETWORK_IP4_ENABLE             = 0x4
> >    DEFINE NETWORK_IP6_ENABLE             = 0x8
> >    DEFINE NETWORK_TLS_ENABLE             = 0x10
> >    DEFINE NETWORK_HTTP_BOOT_ENABLE       = 0x20
> >    DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = 0x40
> >    DEFINE NETWORK_IPSEC_ENABLE           = 0x80
> >    DEFINE NETWORK_ISCSI_ENABLE           = 0x100
> >    DEFINE NETWORK_VLAN_ENABLE            = 0x200
> >
> > [PcdsFixedAtBuild]
> >    gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask|0xFFFF
> >
> > [PcdsFixedAtBuild]
> > !if gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask & NETWORK_ALLOW_HTTP_CONNECTIONS ==
> NETWORK_ALLOW_HTTP_CONNECTIONS
> >   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> > !endif
> 
> Sure, this looks good in the DSC include file, but it looks very bad on
> the build command line. Compare:
> 
>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>     -D NETWORK_ENABLE -D NETWORK_IP4_ENABLE \
>     -D NETWORK_HTTP_BOOT_ENABLE -D NETWORK_TLS_ENABLE
> 
> versus
> 
>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>     --pcd gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask=0x0035

After define FixedAtBuild BOOLEAN type PCD, build command can be specified as below. 
--pcd supports PcdName without PcdTokenSpaceGuid only if PcdName has no confliction. 

   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
     --pcd PcdNetworkEnable=TRUE

> 
> First, composing the second command line takes at least four times as
> long for me (calculating the value 0x35). Second, while
> 
>   grep NETWORK_IP4_ENABLE
> 
> will easily match the first command (in a shell script or similar), the
> same search would require an awkward, ad-hoc parser for matching the
> second command.
> 

grep PcdNetworkEnable can work also. 

> Thanks
> Laszlo
> 
> 
> >> -----Original Message-----
> >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu
> >> Siyuan
> >> Sent: Thursday, November 22, 2018 1:22 PM
> >> To: edk2-devel@lists.01.org
> >> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen,
> >> Jordan L <jordan.l.justen@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Wu,
> >> Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>;
> >> Laszlo Ersek <lersek@redhat.com>; Wei, David <david.wei@intel.com>
> >> Subject: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for
> >> network stack
> >>
> >> There is a patch to remove the redudant IP4 only iSCSI/PXE/TCP drivers
> >>from MdeModulePkg, which has been reviewed before edk2-stable201811
> >> tag.
> >> And we also have plan to move all network related libraries/modules to
> >> NetworkPkg. In order to make these change more smoothly, a set of
> >> fragment
> >> files (2 for DSC and 1 for FDF) are provided for platform to enable the
> >> network stack support, without directly reference the INF module path.
> >>
> >> Patch 1/6 adds centralized dsc/fdf include files to NetworkPkg, with
> >> a set of flags for feature set enable/disable.
> >> Patch 2~6 updates edk2 platform dsc/fdf files to use the new include
> >> files, instead of reference the module INF.
> >>
> >> v2:
> >>  1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
> >>  file. This could provide more flexibility to platform owner to use the
> >>  include files.
> >>  2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
> >>  3. Use "!error" statement for incorrect flag value check.
> >>  4. Update platform DSC/FDF to use the new include files.
> >>  5. Other decoration work according to Laszlo's comments.
> >>
> >>
> >>
> >> Fu Siyuan (6):
> >>  NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
> >>  Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file.
> >>  ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
> >>  EmulatorPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
> >>  OvmfPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
> >>  Vlv2TbltDevicePkg: Update DSC/FDF to use NetworkPkg's include fragment
> >>    file.
> >>
> >> ArmVirtPkg/ArmVirt.dsc.inc              |  11 +-
> >> ArmVirtPkg/ArmVirtQemu.dsc              |  46 ++-----
> >> ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc    |  28 +---
> >> ArmVirtPkg/ArmVirtQemuKernel.dsc        |  46 ++-----
> >> EmulatorPkg/EmulatorPkg.dsc             |  39 ++++--
> >> EmulatorPkg/EmulatorPkg.fdf             |  10 +-
> >> NetworkPkg/Network.fdf.inc              |  69 ++++++++++
> >> NetworkPkg/NetworkComponents.dsc.inc    |  71 ++++++++++
> >> NetworkPkg/NetworkDefines.dsc.inc       | 138 ++++++++++++++++++++
> >> NetworkPkg/NetworkLibs.dsc.inc          |  25 ++++
> >> NetworkPkg/NetworkPcds.dsc.inc          |  22 ++++
> >> NetworkPkg/NetworkPkg.dsc               |  28 +---
> >> Nt32Pkg/Nt32Pkg.dsc                     | 104 ++++-----------
> >> Nt32Pkg/Nt32Pkg.fdf                     |  27 +---
> >> OvmfPkg/OvmfPkgIa32.dsc                 |  75 +++++------
> >> OvmfPkg/OvmfPkgIa32.fdf                 |  27 +---
> >> OvmfPkg/OvmfPkgIa32X64.dsc              |  76 +++++------
> >> OvmfPkg/OvmfPkgIa32X64.fdf              |  27 +---
> >> OvmfPkg/OvmfPkgX64.dsc                  |  75 +++++------
> >> OvmfPkg/OvmfPkgX64.fdf                  |  27 +---
> >> Vlv2TbltDevicePkg/PlatformPkg.fdf       |  25 +---
> >> Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  11 +-
> >> Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    |  25 +---
> >> Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc |  52 +++-----
> >> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |  52 +++-----
> >> Vlv2TbltDevicePkg/PlatformPkgX64.dsc    |  52 +++-----
> >> 26 files changed, 573 insertions(+), 615 deletions(-)
> >> create mode 100644 NetworkPkg/Network.fdf.inc
> >> create mode 100644 NetworkPkg/NetworkComponents.dsc.inc
> >> create mode 100644 NetworkPkg/NetworkDefines.dsc.inc
> >> create mode 100644 NetworkPkg/NetworkLibs.dsc.inc
> >> create mode 100644 NetworkPkg/NetworkPcds.dsc.inc
> >>
> >> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> >> Cc: Ting Ye <ting.ye@intel.com>
> >> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> >> Cc: Hao Wu <hao.a.wu@intel.com>
> >> Cc: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >> Cc: Julien Grall <julien.grall@linaro.org>
> >> Cc: Jordan Justen <jordan.l.justen@intel.com>
> >> Cc: Andrew Fish <afish@apple.com>
> >> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> >> Cc: Anthony Perard <anthony.perard@citrix.com>
> >> Cc: David Wei <david.wei@intel.com>
> >> Cc: Mang Guo <mang.guo@intel.com>
> >>
> >> --
> >> 2.19.1.windows.1
> >>
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/6] ArmVirtPkg: Update DSC/FDF to use NetworkPkg's include fragment file.
  2018-11-22  5:21 ` [PATCH v2 3/6] ArmVirtPkg: " Fu Siyuan
  2018-11-23 12:29   ` Laszlo Ersek
@ 2018-11-23 16:50   ` Laszlo Ersek
  1 sibling, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 16:50 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel

sorry, one more comment for this patch :)

On 11/22/18 06:21, Fu Siyuan wrote:
> This patch updates the platform DSC/FDF files to use the include fragment
> files provided by NetworkPkg.
> The feature enabling flags in [Defines] section have been updated to use
> the NetworkPkg's terms, and the value has been overridden with the original
> default value on this platform.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Julien Grall <julien.grall@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc           | 11 +----
>  ArmVirtPkg/ArmVirtQemu.dsc           | 46 ++++++--------------
>  ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 28 +-----------
>  ArmVirtPkg/ArmVirtQemuKernel.dsc     | 46 ++++++--------------
>  4 files changed, 28 insertions(+), 103 deletions(-)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 70a0ac4d786c..d7de73a88eff 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -76,16 +76,7 @@ [LibraryClasses.common]
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
>  
>    # Networking Requirements
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> -!if $(NETWORK_IP6_ENABLE) == TRUE
> -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> -!endif
> -!if $(HTTP_BOOT_ENABLE) == TRUE
> -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> -!endif
> +!include NetworkPkg/NetworkLibs.dsc.inc
>  
>    #
>    # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.

(3) In case you agree that we should introduce a new DSC include file
for UefiShellNetwork1CommandsLib and UefiShellNetwork2CommandsLib, then
"ArmVirt.dsc.inc" should be adapted to that as well.

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-23 16:02     ` Gao, Liming
@ 2018-11-23 18:35       ` Laszlo Ersek
  2018-11-26  3:31         ` Gao, Liming
  0 siblings, 1 reply; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-23 18:35 UTC (permalink / raw)
  To: Gao, Liming, Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Wei, David

On 11/23/18 17:02, Gao, Liming wrote:
> Laszlo:
>   I add my comments. 
> 
>> -----Original Message-----
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Thursday, November 22, 2018 11:48 PM
>> To: Gao, Liming <liming.gao@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Wu, Hao A
>> <hao.a.wu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>; Wei, David
>> <david.wei@intel.com>
>> Subject: Re: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
>>
>> On 11/22/18 07:14, Gao, Liming wrote:
>>> Siyuan:
>>>   Thanks for your contribution. I really like this idea to share the
>>>   common DSC/FDF between all platform DSC/FDFs.  Now, FixedAtBuild PCD
>>>   can also be used in the conditional statement. Its value can be
>>>   specified by build command with --pcd option. So, I suggest to use
>>>   FixedAtBuild PCD for network feature instead of MACRO. I would like
>>>   to recommend to use PCD both for the build and firmware
>>>   configuration. For this case, one UINT16 FixedAtBuildPcd can be
>>>   introduced in NetworkPkg.dec.  Its different bit will be for the
>>>   different network features. Below is the example.
>>
>> I disagree.
>>
>> A bitmask is a very good representation for *computers*, to handle a set
>> of features. On the other hand, a bitmask is a catastrophically bad
>> representation for *humans*, when they are trying to configure a
>> platform build (that is, writing a build command line), selecting the
>> firmware features they want. It is hard to compute, and it is extremely
>> hard to grep for.
>>
>> It is trivial to grep a build script for "NETWORK_TLS_ENABLE". It is
>> much harder to grep the same script for PcdNetworkFeatureMask, and then
>> check whether bit#4 is set in the value.
> If BitMask is not good for this case, BOOLEAN type FixedAtBuildPcd can be defined to match current macro one by one. 
> For example, gEfiNetworkPkgTokenSpaceGuid.PcdNetworkEnable is added to map macro NETWORK_ENABLE.

I agree that this is technically doable, and that the results (regarding
the build script syntax) are very similar.

But, how is this an improvement over the current -D flags?

> 
>>
>>> Besides, I think *.dsc.inc files need to include section header. If
>>> so, *.dsc.inc is the standalone dsc file. It can easily be included in
>>> platform DSC file.
>>
>> I disagree. For a platform, spelling out the section header is not a big
>> burden, but it provides a lot of flexibility. For example, it can
>> restrict the scope of the included text (e.g., component list) to a
>> specific architecture only. For another example, the platform's section
>> header can specify the flavor of the PCDs for which the included text
>> provides the default values (fixed PCD, patchable PCD, even dynamic(ex)
>> PCD).
>>
>> Standalone DSC file is the wrong thing to aim for, in this instance --
>> in my opinion anyway. Yes, it appears simpler, but it loses too much
>> flexibility. In my earlier comments I pointed out that the "allow
>> plaintext HTTP connections" PCD was declared in NetworkPkg.dec as either
>> fixed or patchable. The dsc.inc file should not squander that
>> flexibility and dictate fixed only.
> This is not TRUE. Dynamic PCD has the different value format, such as DynamicHii PCD.

I think DynamicHII is the only exception here, the rest can be described
with

  TokenSpaceGuid.PcdName|Value

This format should work in [PcdsDynamicDefault], [PcdsFixedAtBuild], and
[PcdsPatchableInModule] sections too. So platforms should have the
freedom to choose.

In the other case, if the DSC include file contains the section header
as well, then the platform loses this choice. The concrete example was
that NetworkPkg.dec declares "PcdAllowHttpConnections" as both
[PcdsFixedAtBuild] and [PcdsPatchableInModule], but in v1, the DSC
include file restricted it to [PcdsFixedAtBuild] only. IMO, if the DEC
file permits several types, then the DSC include file should restrict
those types as little as possible.

> Without section header, DynamicHii PCD can't be specified together with FixedAtBuild Pcd.

Indeed, but it's still better to lose only DynamicHii (when using a DSC
include file) than to lose every type permitted by the DEC file, except
the one type picked by the DSC include file.

> Package level *.pcd.inc provides the recommended type and setting. 
> Platform can override Pcd value and type In their DSC file. BaseTools supports PCD value override, 
> doesn't support PCD type override. This can be supported. 

Then I don't think that introducing a separate -D flag (or a separate
fixed-at-build boolean PCD) for controlling the default value of
"PcdAllowHttpConnections" buys us much.

>>> Especially for library instance, the different library instance may be
>>> for the different module type. Without section header, they can be
>>> placed into one *Libs.dsc.inc file.
>>
>> Ugh... I'm now condfused. Now it seems that you and I are asking for the
>> same thing actually. Did you perhaps mean, above, that "*.dsc.inc files
>> need *NOT* include section header"?
>>
> I miss not.

Wait, now I am even more confused. Did you mean that you did *not* miss
the word "not", or that you missed it?

> I mean without section header, they can't be placed into one *Libs.dsc.inc file.
> Below is one example. One Libs.dsc.inc can list the different library instance for the different module type.
> 
> [LibraryClasses]
>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
> [LibraryClasses.common.SEC]
>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
> [LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf

I understand the example, but this is a totally different use case, from
the NetworkPkg libraries. For the TimerLib class, it is expected (by
design) that different firmware phases / module types use different
library instances.

That's not the case for the six NetworkPkg lib classes in question. Each
of those classes has a single instance, and there's no reason for
implementing other instances. Platforms have no need to customize them,
and they are used by DXE phase (and later), boot time only, modules
anyway. They only exist as library classes for better code structuring /
code sharing, not for customization.

So the actual class -> instance resolutions will never change. What may
change however is how widely a platform wants to employ these
resolutions. Maybe DXE_DRIVER and UEFI_DRIVER modules only. Maybe
UEFI_APPLICATION too. Maybe X64 only. Maybe IA32 and X64 both. And so on.

If we put the section headers in the DSC include file, then the platform
loses this customization possibility.

> 
>>> [Defines]
>>>    DEFINE NETWORK_ENABLE                 = 0x1
>>>    DEFINE NETWORK_SNP_ENABLE             = 0x2
>>>    DEFINE NETWORK_IP4_ENABLE             = 0x4
>>>    DEFINE NETWORK_IP6_ENABLE             = 0x8
>>>    DEFINE NETWORK_TLS_ENABLE             = 0x10
>>>    DEFINE NETWORK_HTTP_BOOT_ENABLE       = 0x20
>>>    DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = 0x40
>>>    DEFINE NETWORK_IPSEC_ENABLE           = 0x80
>>>    DEFINE NETWORK_ISCSI_ENABLE           = 0x100
>>>    DEFINE NETWORK_VLAN_ENABLE            = 0x200
>>>
>>> [PcdsFixedAtBuild]
>>>    gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask|0xFFFF
>>>
>>> [PcdsFixedAtBuild]
>>> !if gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask & NETWORK_ALLOW_HTTP_CONNECTIONS ==
>> NETWORK_ALLOW_HTTP_CONNECTIONS
>>>   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
>>> !endif
>>
>> Sure, this looks good in the DSC include file, but it looks very bad on
>> the build command line. Compare:
>>
>>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>>     -D NETWORK_ENABLE -D NETWORK_IP4_ENABLE \
>>     -D NETWORK_HTTP_BOOT_ENABLE -D NETWORK_TLS_ENABLE
>>
>> versus
>>
>>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>>     --pcd gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask=0x0035
> 
> After define FixedAtBuild BOOLEAN type PCD, build command can be specified as below. 
> --pcd supports PcdName without PcdTokenSpaceGuid only if PcdName has no confliction. 
> 
>    build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>      -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>      --pcd PcdNetworkEnable=TRUE

Yes, I agree that this reads nicely, and it is easy to grep for.

But, again, what does it buy us over "-D"?

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-23 18:35       ` Laszlo Ersek
@ 2018-11-26  3:31         ` Gao, Liming
  2018-11-26 11:34           ` Laszlo Ersek
  0 siblings, 1 reply; 26+ messages in thread
From: Gao, Liming @ 2018-11-26  3:31 UTC (permalink / raw)
  To: Laszlo Ersek, Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Wei, David, Gao, Liming

Laszlo:
  
Thanks
Liming
>-----Original Message-----
>From: Laszlo Ersek [mailto:lersek@redhat.com]
>Sent: Saturday, November 24, 2018 2:36 AM
>To: Gao, Liming <liming.gao@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>;
>edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen,
>Jordan L <jordan.l.justen@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Wu,
>Jiaxin <jiaxin.wu@intel.com>; Anthony Perard <anthony.perard@citrix.com>;
>Wei, David <david.wei@intel.com>
>Subject: Re: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for
>network stack
>
>On 11/23/18 17:02, Gao, Liming wrote:
>> Laszlo:
>>   I add my comments.
>>
>>> -----Original Message-----
>>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>>> Sent: Thursday, November 22, 2018 11:48 PM
>>> To: Gao, Liming <liming.gao@intel.com>; Fu, Siyuan
><siyuan.fu@intel.com>; edk2-devel@lists.01.org
>>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Justen,
>Jordan L <jordan.l.justen@intel.com>; Wu, Hao A
>>> <hao.a.wu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Anthony
>Perard <anthony.perard@citrix.com>; Wei, David
>>> <david.wei@intel.com>
>>> Subject: Re: [edk2] [PATCH v2 0/6] Add DSC/FDF include segment files for
>network stack
>>>
>>> On 11/22/18 07:14, Gao, Liming wrote:
>>>> Siyuan:
>>>>   Thanks for your contribution. I really like this idea to share the
>>>>   common DSC/FDF between all platform DSC/FDFs.  Now, FixedAtBuild
>PCD
>>>>   can also be used in the conditional statement. Its value can be
>>>>   specified by build command with --pcd option. So, I suggest to use
>>>>   FixedAtBuild PCD for network feature instead of MACRO. I would like
>>>>   to recommend to use PCD both for the build and firmware
>>>>   configuration. For this case, one UINT16 FixedAtBuildPcd can be
>>>>   introduced in NetworkPkg.dec.  Its different bit will be for the
>>>>   different network features. Below is the example.
>>>
>>> I disagree.
>>>
>>> A bitmask is a very good representation for *computers*, to handle a set
>>> of features. On the other hand, a bitmask is a catastrophically bad
>>> representation for *humans*, when they are trying to configure a
>>> platform build (that is, writing a build command line), selecting the
>>> firmware features they want. It is hard to compute, and it is extremely
>>> hard to grep for.
>>>
>>> It is trivial to grep a build script for "NETWORK_TLS_ENABLE". It is
>>> much harder to grep the same script for PcdNetworkFeatureMask, and
>then
>>> check whether bit#4 is set in the value.
>> If BitMask is not good for this case, BOOLEAN type FixedAtBuildPcd can be
>defined to match current macro one by one.
>> For example, gEfiNetworkPkgTokenSpaceGuid.PcdNetworkEnable is added
>to map macro NETWORK_ENABLE.
>
>I agree that this is technically doable, and that the results (regarding
>the build script syntax) are very similar.
>
>But, how is this an improvement over the current -D flags?
>
PCD has been used to configure the firmware setting. It can also be used for the firmware build configuration. 
I would like to introduce PCD as the same configuration way. If so,  new users don't need to remember other syntax

>>
>>>
>>>> Besides, I think *.dsc.inc files need to include section header. If
>>>> so, *.dsc.inc is the standalone dsc file. It can easily be included in
>>>> platform DSC file.
>>>
>>> I disagree. For a platform, spelling out the section header is not a big
>>> burden, but it provides a lot of flexibility. For example, it can
>>> restrict the scope of the included text (e.g., component list) to a
>>> specific architecture only. For another example, the platform's section
>>> header can specify the flavor of the PCDs for which the included text
>>> provides the default values (fixed PCD, patchable PCD, even dynamic(ex)
>>> PCD).
>>>
>>> Standalone DSC file is the wrong thing to aim for, in this instance --
>>> in my opinion anyway. Yes, it appears simpler, but it loses too much
>>> flexibility. In my earlier comments I pointed out that the "allow
>>> plaintext HTTP connections" PCD was declared in NetworkPkg.dec as either
>>> fixed or patchable. The dsc.inc file should not squander that
>>> flexibility and dictate fixed only.
>> This is not TRUE. Dynamic PCD has the different value format, such as
>DynamicHii PCD.
>
>I think DynamicHII is the only exception here, the rest can be described
>with
>
>  TokenSpaceGuid.PcdName|Value
>
>This format should work in [PcdsDynamicDefault], [PcdsFixedAtBuild], and
>[PcdsPatchableInModule] sections too. So platforms should have the
>freedom to choose.
>
I want to discuss the general rules on how to share the package configuration 
in the different platform DSC/FDF. NetworkPkg is the first case. After it, 
other package maintainer may provide his package setting with the similar style. 
In my idea, each package has one *Pcds.dsc.inc, *Libs.dsc.inc, 
*ComponentsPei.dsc.inc and *ComponentsDxe.dsc.inc. Normal platform 
developers just need to include them in the platform DSC. Advanced platform
user may modify Pcd type/value and Library class selection in platform DSC.
Its purpose is to simply the platform DSC. I agree this style will not have the 
same flexibility. But, to keep the flexibility, every PCD may have its Pcds.dsc.inc, 
because the different PCD may be configured to the different type. 
NetworkPkg provides one only PCD. So, it has one Pcds.dsc.inc. If other package 
provides 3 PCDs, there will be three *Pcds.dsc.inc files. If so, I don't think we
need to add those *Pcds.dsc.inc. User can directly add Pcd in Platform DSC file 
instead of include *Pcds.dsc.inc file. 

>In the other case, if the DSC include file contains the section header
>as well, then the platform loses this choice. The concrete example was
>that NetworkPkg.dec declares "PcdAllowHttpConnections" as both
>[PcdsFixedAtBuild] and [PcdsPatchableInModule], but in v1, the DSC
>include file restricted it to [PcdsFixedAtBuild] only. IMO, if the DEC
>file permits several types, then the DSC include file should restrict
>those types as little as possible.
>
>> Without section header, DynamicHii PCD can't be specified together with
>FixedAtBuild Pcd.
>
>Indeed, but it's still better to lose only DynamicHii (when using a DSC
>include file) than to lose every type permitted by the DEC file, except
>the one type picked by the DSC include file.
>
>> Package level *.pcd.inc provides the recommended type and setting.
>> Platform can override Pcd value and type In their DSC file. BaseTools
>supports PCD value override,
>> doesn't support PCD type override. This can be supported.
>
>Then I don't think that introducing a separate -D flag (or a separate
>fixed-at-build boolean PCD) for controlling the default value of
>"PcdAllowHttpConnections" buys us much.
>
For this case, PcdAllowHttpConnections can be used to control the build configuration and firmware functionality. 
We don't need to introduce the additional MACRO for it. This is another benefit of PCD. 
>>>> Especially for library instance, the different library instance may be
>>>> for the different module type. Without section header, they can be
>>>> placed into one *Libs.dsc.inc file.
>>>
>>> Ugh... I'm now condfused. Now it seems that you and I are asking for the
>>> same thing actually. Did you perhaps mean, above, that "*.dsc.inc files
>>> need *NOT* include section header"?
>>>
>> I miss not.
>
>Wait, now I am even more confused. Did you mean that you did *not* miss
>the word "not", or that you missed it?
>
I lost 'not' in previous statement. 
Previous: Without section header, they can be placed into one *Libs.dsc.inc file.
Correct:  Without section header, they can't be placed into one *Libs.dsc.inc file.
>> I mean without section header, they can't be placed into one *Libs.dsc.inc
>file.
>> Below is one example. One Libs.dsc.inc can list the different library instance
>for the different module type.
>>
>> [LibraryClasses]
>>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
>> [LibraryClasses.common.SEC]
>>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
>> [LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
>>   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf
>
>I understand the example, but this is a totally different use case, from
>the NetworkPkg libraries. For the TimerLib class, it is expected (by
>design) that different firmware phases / module types use different
>library instances.
>
>That's not the case for the six NetworkPkg lib classes in question. Each
>of those classes has a single instance, and there's no reason for
>implementing other instances. Platforms have no need to customize them,
>and they are used by DXE phase (and later), boot time only, modules
>anyway. They only exist as library classes for better code structuring /
>code sharing, not for customization.
>
>So the actual class -> instance resolutions will never change. What may
>change however is how widely a platform wants to employ these
>resolutions. Maybe DXE_DRIVER and UEFI_DRIVER modules only. Maybe
>UEFI_APPLICATION too. Maybe X64 only. Maybe IA32 and X64 both. And so
>on.
>
>If we put the section headers in the DSC include file, then the platform
>loses this customization possibility.
NetworkPkg case is simple. Those six library instances are for the same module type and ARCHs. 
I don't see the different usage in the platform DSC. Similar to PCD, to keep the flexibility, every
Library instance may have its *.Libs.dsc.inc. If so, it is not necessary to add *.Libs.dsc.inc.
>>
>>>> [Defines]
>>>>    DEFINE NETWORK_ENABLE                 = 0x1
>>>>    DEFINE NETWORK_SNP_ENABLE             = 0x2
>>>>    DEFINE NETWORK_IP4_ENABLE             = 0x4
>>>>    DEFINE NETWORK_IP6_ENABLE             = 0x8
>>>>    DEFINE NETWORK_TLS_ENABLE             = 0x10
>>>>    DEFINE NETWORK_HTTP_BOOT_ENABLE       = 0x20
>>>>    DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = 0x40
>>>>    DEFINE NETWORK_IPSEC_ENABLE           = 0x80
>>>>    DEFINE NETWORK_ISCSI_ENABLE           = 0x100
>>>>    DEFINE NETWORK_VLAN_ENABLE            = 0x200
>>>>
>>>> [PcdsFixedAtBuild]
>>>>    gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask|0xFFFF
>>>>
>>>> [PcdsFixedAtBuild]
>>>> !if gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask &
>NETWORK_ALLOW_HTTP_CONNECTIONS ==
>>> NETWORK_ALLOW_HTTP_CONNECTIONS
>>>>   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
>>>> !endif
>>>
>>> Sure, this looks good in the DSC include file, but it looks very bad on
>>> the build command line. Compare:
>>>
>>>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>>>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>>>     -D NETWORK_ENABLE -D NETWORK_IP4_ENABLE \
>>>     -D NETWORK_HTTP_BOOT_ENABLE -D NETWORK_TLS_ENABLE
>>>
>>> versus
>>>
>>>   build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>>>     -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>>>     --pcd
>gEfiNetworkPkgTokenSpaceGuid.PcdNetworkFeatureMask=0x0035
>>
>> After define FixedAtBuild BOOLEAN type PCD, build command can be
>specified as below.
>> --pcd supports PcdName without PcdTokenSpaceGuid only if PcdName has
>no confliction.
>>
>>    build -a X64 -p OvmfPkg/OvmfPkgX64.dsc -t GCC48 -b NOOPT \
>>      -D SECURE_BOOT_ENABLE -D SMM_REQUIRE \
>>      --pcd PcdNetworkEnable=TRUE
>
>Yes, I agree that this reads nicely, and it is easy to grep for.
>
>But, again, what does it buy us over "-D"?
>
>Thanks!
>Laszlo

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/6] Add DSC/FDF include segment files for network stack
  2018-11-26  3:31         ` Gao, Liming
@ 2018-11-26 11:34           ` Laszlo Ersek
  0 siblings, 0 replies; 26+ messages in thread
From: Laszlo Ersek @ 2018-11-26 11:34 UTC (permalink / raw)
  To: Gao, Liming, Fu, Siyuan, edk2-devel@lists.01.org
  Cc: Ni, Ruiyu, Ye, Ting, Justen, Jordan L, Wu, Hao A, Wu, Jiaxin,
	Anthony Perard, Wei, David

Hi Liming,

On 11/26/18 04:31, Gao, Liming wrote:
> [...]

Thanks, I think I understand your points better.

That doesn't mean that I agree with all of your points. :)

My suggestion/request is that this series please drop the OvmfPkg &
ArmVirtPkg patches for now, as it's obvious that my preferences cannot
"drive" the NetworkPkg changes, let alone the general, future rules (of
which NetworkPkg is just the first example).

Thus, I'd like to spare Siyuan the repeated updates to OvmfPkg and
ArmVirtPkg.

Instead, once the NetworkPkg changes are mature enough to exemplify the
future rules, and they are merged, we should file TianoCore BZs for
ArmVirtPkg and OvmfPkg, to adopt the new config knobs from NetworkPkg.
These BZs should be assigned to their respective package maintainers,
and they should be considered "best effort". I.e. ArmVirtPkg and OvmfPkg
will consume those new settings from NetworkPkg that they easily can,
and fall back to the explicit configuration everywhere else.

My request is that the NetworkPkg changes please remain backward
compatible, so that existing platforms not break even until they are
updated to take advantage of the new PCDs.

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-11-23 10:56   ` Laszlo Ersek
@ 2018-12-10  8:36     ` Ard Biesheuvel
  2018-12-10 14:40       ` Laszlo Ersek
  0 siblings, 1 reply; 26+ messages in thread
From: Ard Biesheuvel @ 2018-12-10  8:36 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Siyuan Fu, edk2-devel@lists.01.org, Ye, Ting, Wu, Jiaxin,
	Leif Lindholm

On Fri, 23 Nov 2018 at 11:57, Laszlo Ersek <lersek@redhat.com> wrote:
>
> +Ard, +Leif
>
> On 11/22/18 06:21, Fu Siyuan wrote:
> > This patch provides a set of include segment files for platform owner to
> > easily enable/disable network stack support on their platform.
> >
> > For DSC, there are:
> > - a "NetworkDefines.dsc.inc" for the [Defines] section(s),
> > - a "NetworkLibs.dsc.inc" for the [LibraryClasses*] section(s),
> > - a "NetworkPcds.dsc.inc" for the [Pcds*] section(s),
> > - a "NetworkComponents.dsc.inc" for the [Components*] section(s).
> > For FDF, there is:
> > - a "Network.fdf.inc" for the [Fv*] section(s).
> >
> > These files can be added to the platform DSC/FDF file by using
> >   !include NetworkPkg/xxx
> > where "xxx" is the *.inc file name.
> >
> > A set of flags can be changed before the include line or in build command
> > line ("-D FLAG=VALUE") to enable or disable related feature set, please
> > check "NetworkDefines.dsc.inc" for a detail description of each flag.
> >
> > The default value of these flags are:
> >   DEFINE NETWORK_ENABLE                 = TRUE
> >   DEFINE NETWORK_SNP_ENABLE             = TRUE
> >   DEFINE NETWORK_IP4_ENABLE             = TRUE
> >   DEFINE NETWORK_IP6_ENABLE             = TRUE
> >   DEFINE NETWORK_TLS_ENABLE             = TRUE
> >   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> >   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> >   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> >   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> >   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> >
> > Related BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1293
> >
> > Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> > Cc: Ting Ye <ting.ye@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> > ---
> >
> > Notes:
> >     v2:
> >     1. Split the "Network.dsc.inc" in to 4 files for different sections in DSC
> >     file. This could provide more flexibility to platform owner to use the
> >     include files.
> >     2. Clarify the OpenSSL dependency of TLS, iSCSI and IPsec enable flag.
> >     3. Use "!error" statement for incorrect flag value check.
> >     4. Other decoration work according to Laszlo's comments.
> >
> >  NetworkPkg/Network.fdf.inc           |  69 ++++++++++
> >  NetworkPkg/NetworkComponents.dsc.inc |  71 ++++++++++
> >  NetworkPkg/NetworkDefines.dsc.inc    | 138 ++++++++++++++++++++
> >  NetworkPkg/NetworkLibs.dsc.inc       |  25 ++++
> >  NetworkPkg/NetworkPcds.dsc.inc       |  22 ++++
> >  NetworkPkg/NetworkPkg.dsc            |  28 +---
> >  6 files changed, 331 insertions(+), 22 deletions(-)
> >
> > diff --git a/NetworkPkg/Network.fdf.inc b/NetworkPkg/Network.fdf.inc
> > new file mode 100644
> > index 000000000000..abd4c6c363d5
> > --- /dev/null
> > +++ b/NetworkPkg/Network.fdf.inc
> > @@ -0,0 +1,69 @@
> > +## @file
> > +# Network FDF include file for All Architectures.
> > +#
> > +# This file can be included to a platform FDF by using "!include NetworkPkg/Network.fdf.inc"
> > +# to add EDKII network stack drivers according to the value of flags described in
> > +# "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license may be found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> > +
> > +  !if $(NETWORK_SNP_ENABLE) == TRUE
> > +    INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> > +    INF  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> > +  !endif
> > +
> > +  INF  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> > +
> > +  !if $(NETWORK_IP4_ENABLE) == TRUE
> > +    INF  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> > +    INF  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IP6_ENABLE) == TRUE
> > +    INF  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > +    INF  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > +    INF  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > +    INF  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > +  !endif
> > +
> > +  INF  NetworkPkg/TcpDxe/TcpDxe.inf
> > +  INF  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > +
> > +  !if $(NETWORK_TLS_ENABLE) == TRUE
> > +    INF  NetworkPkg/TlsDxe/TlsDxe.inf
> > +    INF  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> > +    INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +    INF  NetworkPkg/HttpDxe/HttpDxe.inf
> > +    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > +    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> > +    INF  NetworkPkg/IScsiDxe/IScsiDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> > +    INF  NetworkPkg/IpSecDxe/IpSecDxe.inf
> > +  !endif
> > +!endif
>
> This part looks good!
>
> > diff --git a/NetworkPkg/NetworkComponents.dsc.inc b/NetworkPkg/NetworkComponents.dsc.inc
> > new file mode 100644
> > index 000000000000..8074489b8e06
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkComponents.dsc.inc
> > @@ -0,0 +1,71 @@
> > +## @file
> > +# Network DSC include file for [Components*] section of all Architectures.
> > +#
> > +# This file can be included to the [Components*] section(s) of a platform DSC file
> > +# by using "!include NetworkPkg/NetworkComponents.dsc.inc" to specify the INF files
> > +# of EDKII network drivers according to the value of flags described in
> > +# "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license may be found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
> > +
> > +  !if $(NETWORK_SNP_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_VLAN_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
> > +  !endif
> > +
> > +  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
> > +
> > +  !if $(NETWORK_IP4_ENABLE) == TRUE
> > +    MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
> > +    MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
> > +    MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IP6_ENABLE) == TRUE
> > +    NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > +    NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > +    NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > +    NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > +  !endif
> > +
> > +  NetworkPkg/TcpDxe/TcpDxe.inf
> > +  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > +
> > +  !if $(NETWORK_TLS_ENABLE) == TRUE
> > +    NetworkPkg/TlsDxe/TlsDxe.inf
> > +    NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
> > +    NetworkPkg/DnsDxe/DnsDxe.inf
> > +    NetworkPkg/HttpDxe/HttpDxe.inf
> > +    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > +    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_ISCSI_ENABLE) == TRUE
> > +    NetworkPkg/IScsiDxe/IScsiDxe.inf
> > +  !endif
> > +
> > +  !if $(NETWORK_IPSEC_ENABLE) == TRUE
> > +    NetworkPkg/IpSecDxe/IpSecDxe.inf
> > +  !endif
> > +!endif
>
> This also looks great; it matches the order & formatting of the FDF
> include file too.
>
> > diff --git a/NetworkPkg/NetworkDefines.dsc.inc b/NetworkPkg/NetworkDefines.dsc.inc
> > new file mode 100644
> > index 000000000000..648c065baadb
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkDefines.dsc.inc
> > @@ -0,0 +1,138 @@
> > +## @file
> > +# Network DSC include file for [Defines] section of all Architectures.
> > +#
> > +# This file can be included to the [Defines] section of a platform DSC file by
> > +# using "!include NetworkPkg/NetworkDefines.dsc.inc" to set default value of
> > +# flags if they are not defined somewhere else, and also check the value to see
> > +# if there is any conflict.
> > +#
> > +# These flags can be defined before the !include line, or changed on the command
> > +# line to enable or disable related feature support.
> > +#   -D FLAG=VALUE
> > +# The default value of these flags are:
> > +#   DEFINE NETWORK_ENABLE                 = TRUE
> > +#   DEFINE NETWORK_SNP_ENABLE             = TRUE
> > +#   DEFINE NETWORK_IP4_ENABLE             = TRUE
> > +#   DEFINE NETWORK_IP6_ENABLE             = TRUE
> > +#   DEFINE NETWORK_TLS_ENABLE             = TRUE
> > +#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
> > +#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> > +#   DEFINE NETWORK_IPSEC_ENABLE           = TRUE
> > +#   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
> > +#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
> > +#
> > +# Copyright (c) 2018, 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 text of the license may be found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!ifndef NETWORK_ENABLE
> > +  #
> > +  # This flag is to enable or disable the whole network stack.
> > +  #
> > +  DEFINE NETWORK_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_SNP_ENABLE
> > +  #
> > +  # This flag is to include the common SNP driver or not.
> > +  #
> > +  DEFINE NETWORK_SNP_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_VLAN_ENABLE
> > +  #
> > +  # This flag is to enable or disable VLAN feature.
> > +  #
> > +  DEFINE NETWORK_VLAN_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_IP4_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPv4 network stack.
> > +  #
> > +  DEFINE NETWORK_IP4_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_IP6_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPv6 network stack.
> > +  #
> > +  DEFINE NETWORK_IP6_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_TLS_ENABLE
> > +  #
> > +  # This flag is to enable or disable TLS feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> > +  #       The OpensslLib.inf library instance should be used since libssl is required.
> > +  #
> > +  DEFINE NETWORK_TLS_ENABLE = TRUE
> > +!endif
>
> Nice, thanks!
>

Could anyone remind me why we have OpensslLib and OpensslLibCrypto?
Since these are static libraries, only the referenced objects should
be included in the final module anyway, so OpensslLibCrypto seems
redundant to me.

> > +
> > +!ifndef NETWORK_HTTP_BOOT_ENABLE
> > +  #
> > +  # This flag is to enable or disable HTTP(S) boot feature.
> > +  #
> > +  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
> > +!endif
> > +
> > +!ifndef NETWORK_ALLOW_HTTP_CONNECTIONS
> > +  #
> > +  # Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
> > +  #
> > +  # Note: If NETWORK_ALLOW_HTTP_CONNECTIONS is TRUE, HTTP connections are allowed.
> > +  #       Both the "https://" and "http://" URI schemes are permitted. Otherwise, HTTP
> > +  #       connections are denied. Only the "https://" URI scheme is permitted.
> > +  #
> > +  DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
> > +!endif
> > +
> > +!ifndef NETWORK_ISCSI_ENABLE
> > +  #
> > +  # This flag is to enable or disable iSCSI feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> > +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
> > +  #       since libssl is not required for iSCSI.
> > +  #
> > +  DEFINE NETWORK_ISCSI_ENABLE = TRUE
> > +!endif
>
> Very clear. Great.
>
> > +
> > +!ifndef NETWORK_IPSEC_ENABLE
> > +  #
> > +  # This flag is to enable or disable IPsec feature.
> > +  #
> > +  # Note: This feature depends on the OpenSSL building. To enable this feature, please
> > +  #       follow the instructions found in the file "OpenSSL-HOWTO.txt" located in
> > +  #       CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
> > +  #       Both OpensslLib.inf and OpensslLibCrypto.inf library instance can be used
> > +  #       since libssl is not required for IPsec.
> > +  #
> > +  DEFINE NETWORK_IPSEC_ENABLE = TRUE
> > +!endif
> > +
>
> Ditto.
>
> One request for this file, at a higher level:
>
> (1) The order of the default settings in this file *almost* matches the
> order of the flags in the summary, at the top -- but not completely. Can
> you please reorder the defaults so they match the summary? Basically:
> - move the NETWORK_ISCSI_ENABLE to the end,
> - then move NETWORK_VLAN_ENABLE to the end (after NETWORK_ISCSI_ENABLE).
>
> That should restore the right order.
>
> > +!if $(NETWORK_ENABLE) == TRUE
> > +  #
> > +  # Check the flags to see if there is any conflict.
> > +  #
> > +  !if ($(NETWORK_IP4_ENABLE) == FALSE) AND ($(NETWORK_IP6_ENABLE) == FALSE)
> > +    !error "Must enable at least IP4 or IP6 stack if NETWORK_ENABLE is set to TRUE!"
> > +  !endif
> > +
> > +  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND ($(NETWORK_TLS_ENABLE) == FALSE) AND ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
> > +    !error "Must enable TLS to support HTTPS, or allow unsecured HTTP connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
> > +  !endif
> > +!endif
>
> Nice.
>
> > diff --git a/NetworkPkg/NetworkLibs.dsc.inc b/NetworkPkg/NetworkLibs.dsc.inc
> > new file mode 100644
> > index 000000000000..67d09c262074
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkLibs.dsc.inc
> > @@ -0,0 +1,25 @@
> > +## @file
> > +# Network DSC include file for [LibraryClasses*] section of all Architectures.
> > +#
> > +# This file can be included to the [LibraryClasses*] section(s) of a platform DSC file
> > +# by using "!include NetworkPkg/NetworkLibs.dsc.inc" to specify the library instances
> > +# of EDKII network library classes.
> > +#
> > +# Copyright (c) 2018, 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 text of the license may be found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> > +  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> > +  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> > +  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> > +  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> > +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
>
> In theory, it would be possible to wrap this part into a NETWORK_ENABLE
> condition, and then resolve some of the library classes conditional on
> further flags, such as HttpLib dependent on NETWORK_HTTP_BOOT_ENABLE.
>
> However:
>
> - these library instances are not meant to be replaced by other libary
> instances, when a platform needs the library classes for any purpose
> (i.e., these are single-instance lib classes),
>
> - and even if the platform doesn't need some (or all) of these lib
> classes, resolving them does no harm (negligible performance impact).
>
> So I agree to keep this part simple.
>
> > diff --git a/NetworkPkg/NetworkPcds.dsc.inc b/NetworkPkg/NetworkPcds.dsc.inc
> > new file mode 100644
> > index 000000000000..3eee5b3ae0bf
> > --- /dev/null
> > +++ b/NetworkPkg/NetworkPcds.dsc.inc
> > @@ -0,0 +1,22 @@
> > +## @file
> > +# Network DSC include file for [Pcds*] section of all Architectures.
> > +#
> > +# This file can be included to the [Pcds*] section(s) of a platform DSC file
> > +# by using "!include NetworkPkg/NetworkPcds.dsc.inc" to specify PCD settings
> > +# according to the value of flags described in "NetworkDefines.dsc.inc".
> > +#
> > +# Copyright (c) 2018, 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 text of the license may be found at
> > +#    http://opensource.org/licenses/bsd-license.php
> > +#
> > +#    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +#    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> > +#
> > +##
> > +
> > +!if $(NETWORK_ALLOW_HTTP_CONNECTIONS) == TRUE
> > +  gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
> > +!endif
>
> (2) Looks good, but I think the PCD setting should be restricted
> *additionally* to NETWORK_ENABLE && NETWORK_HTTP_BOOT_ENABLE.
>
> > diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
> > index b543caa08fb1..654f73785054 100644
> > --- a/NetworkPkg/NetworkPkg.dsc
> > +++ b/NetworkPkg/NetworkPkg.dsc
> > @@ -24,6 +24,8 @@ [Defines]
> >    BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> >    SKUID_IDENTIFIER               = DEFAULT
> >
> > +!include NetworkPkg/NetworkDefines.dsc.inc
> > +
> >  [LibraryClasses]
> >    DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> >    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> > @@ -47,12 +49,8 @@ [LibraryClasses]
> >    DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
> >    SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> >
> > -  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
> > -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> > -  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> > -  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> > -  TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
> > -  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> > +!include NetworkPkg/NetworkLibs.dsc.inc
> > +
> >    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> >    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> >    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> > @@ -86,6 +84,7 @@ [PcdsFeatureFlag]
> >  [PcdsFixedAtBuild]
> >    gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
> >    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
> > +!include NetworkPkg/NetworkPcds.dsc.inc
> >
> >  ###################################################################################################
> >  #
> > @@ -107,25 +106,10 @@ [PcdsFixedAtBuild]
> >  ###################################################################################################
> >
> >  [Components]
> > -  NetworkPkg/Ip6Dxe/Ip6Dxe.inf
> > -  NetworkPkg/TcpDxe/TcpDxe.inf
> > -  NetworkPkg/Udp6Dxe/Udp6Dxe.inf
> > -  NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
> > -  NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
> > -  NetworkPkg/DnsDxe/DnsDxe.inf
> > -  NetworkPkg/HttpDxe/HttpDxe.inf
> > -  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> > -  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +!include NetworkPkg/NetworkComponents.dsc.inc
> >
> >    NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> >    NetworkPkg/Application/VConfig/VConfig.inf
> >
> > -[Components.IA32, Components.X64]
> > -  NetworkPkg/IpSecDxe/IpSecDxe.inf
> > -  NetworkPkg/IScsiDxe/IScsiDxe.inf
> > -  NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
> > -  NetworkPkg/TlsDxe/TlsDxe.inf
> > -  NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf
> > -
> >  [BuildOptions]
> >    *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> >
>
> This part makes me curious. :)
>
> It's good that the defaults for the new build flags ensure that
> NetworkPkg.dsc's coverage not shrink -- everything that used to be built
> by default continues to be built by default. However:
>
> (3) This change will build IpSecDxe, IScsiDxe, UefiPxeBcDxe, TlsDxe and
> TlsAuthConfigDxe on ARM and AARCH64 as well. I actually welcome that,
> but that's a functional change, and so it should be a separate patch.
>
> Namely, please *prepend* a patch to the series that simply deletes the
> "[Components.IA32, Components.X64]" line, bringing all these drivers to
> ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
> separately (simply by test-building it), then the current patch can
> simply replace the component list with the !include directive -- and
> such a replacement won't incur arch-specific changes.
>

Ack

> (4) I'm noticing there are two applications too. Should we move them to
> "NetworkApps.dsc.inc" and "NetworkApps.fdf.inc", perhaps?
>
> And in those include files, the individual apps would be gated by
> NETWORK_ENABLE, plus NETWORK_IPSEC_ENABLE / NETWORK_VLAN_ENABLE.
>
> This is a tricky question, so I don't mind if we solve it later, or
> don't solve it at all. It is tricky because:
>
> - Even if a platform builds these features into the platform firmware,
> it might not want to offer these applications -- and then we shouldn't
> even build the applications. Therefore, we shouldn't simply move the
> applications to the components include file. Hence "NetworkApps.dsc.inc".
>
> - Assuming a platform *does* want to offer these applications (and hence
> builds them through the suggested "NetworkApps.dsc.inc"), the apps could
> be offered in a different firmware volume, or even on external
> (remvoable) media. That means that we shouldn't simply add the apps to
> the FDF include file. Hence "NetworkApps.fdf.inc".
>
> Anyway, this is just my curiosity. :)
>
>
> In summary, I would be OK with you fixing up (1) and (2) on push (and I
> considered givig my R-b on that condition, in advance). And, I'm fine
> ignoring (4) totally at the moment. However, for (3), I'd really like if
> we could build-test that change in separation. And then the next version
> (v3) of this specific patch would be totally architecture-independent.
>

This looking very good, and will be useful in many places. Thanks for
doing this cleanup.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-12-10  8:36     ` Ard Biesheuvel
@ 2018-12-10 14:40       ` Laszlo Ersek
  2018-12-10 16:39         ` Ard Biesheuvel
  0 siblings, 1 reply; 26+ messages in thread
From: Laszlo Ersek @ 2018-12-10 14:40 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Siyuan Fu, edk2-devel@lists.01.org, Ye, Ting, Wu, Jiaxin,
	Leif Lindholm

Hi Ard,

On 12/10/18 09:36, Ard Biesheuvel wrote:

> Could anyone remind me why we have OpensslLib and OpensslLibCrypto?
> Since these are static libraries, only the referenced objects should
> be included in the final module anyway, so OpensslLibCrypto seems
> redundant to me.

please see commit 823005621ef4 ("CryptoPkg/OpensslLib: introduce
OpensslLibCrypto instance", 2017-02-25).

>> Namely, please *prepend* a patch to the series that simply deletes the
>> "[Components.IA32, Components.X64]" line, bringing all these drivers to
>> ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
>> separately (simply by test-building it), then the current patch can
>> simply replace the component list with the !include directive -- and
>> such a replacement won't incur arch-specific changes.
>>
> 
> Ack

Liming and I strongly disagreed on this point, and I yielded. Please see
the sub-thread that ended with the following comment:

http://mid.mail-archive.com/e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com

(Alternative link:
<https://lists.01.org/pipermail/edk2-devel/2018-November/032949.html>.)

[...]

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg.
  2018-12-10 14:40       ` Laszlo Ersek
@ 2018-12-10 16:39         ` Ard Biesheuvel
  0 siblings, 0 replies; 26+ messages in thread
From: Ard Biesheuvel @ 2018-12-10 16:39 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Siyuan Fu, edk2-devel@lists.01.org, Ye, Ting, Wu, Jiaxin,
	Leif Lindholm

On Mon, 10 Dec 2018 at 15:40, Laszlo Ersek <lersek@redhat.com> wrote:
>
> Hi Ard,
>
> On 12/10/18 09:36, Ard Biesheuvel wrote:
>
> > Could anyone remind me why we have OpensslLib and OpensslLibCrypto?
> > Since these are static libraries, only the referenced objects should
> > be included in the final module anyway, so OpensslLibCrypto seems
> > redundant to me.
>
> please see commit 823005621ef4 ("CryptoPkg/OpensslLib: introduce
> OpensslLibCrypto instance", 2017-02-25).
>

Right, fair enough.


> >> Namely, please *prepend* a patch to the series that simply deletes the
> >> "[Components.IA32, Components.X64]" line, bringing all these drivers to
> >> ARM/AARCH64, in the NetworkPkg.dsc build. Once we validate the new patch
> >> separately (simply by test-building it), then the current patch can
> >> simply replace the component list with the !include directive -- and
> >> such a replacement won't incur arch-specific changes.
> >>
> >
> > Ack
>
> Liming and I strongly disagreed on this point, and I yielded. Please see
> the sub-thread that ended with the following comment:
>
> http://mid.mail-archive.com/e790855d-2cd9-1820-7187-0ec1dc52dabc@redhat.com
>
> (Alternative link:
> <https://lists.01.org/pipermail/edk2-devel/2018-November/032949.html>.)
>

As long as we end up with a NetworkPkg.dsc that covers everything for
all arches, I'm fine with whichever order we apply the changes.


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-12-10 16:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22  5:21 [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Fu Siyuan
2018-11-22  5:21 ` [PATCH v2 1/6] NetworkPkg: Add DSC/FDF include segment files to NetworkPkg Fu Siyuan
2018-11-22  9:56   ` Ni, Ruiyu
2018-11-22 10:52     ` Fu, Siyuan
2018-11-23 10:56   ` Laszlo Ersek
2018-12-10  8:36     ` Ard Biesheuvel
2018-12-10 14:40       ` Laszlo Ersek
2018-12-10 16:39         ` Ard Biesheuvel
2018-11-22  5:21 ` [PATCH v2 2/6] Nt32Pkg: Update DSC/FDF to use NetworkPkg's include fragment file Fu Siyuan
2018-11-22  5:21 ` [PATCH v2 3/6] ArmVirtPkg: " Fu Siyuan
2018-11-23 12:29   ` Laszlo Ersek
2018-11-23 12:30     ` Laszlo Ersek
2018-11-23 16:50   ` Laszlo Ersek
2018-11-22  5:21 ` [PATCH v2 4/6] EmulatorPkg: " Fu Siyuan
2018-11-22  5:21 ` [PATCH v2 5/6] OvmfPkg: " Fu Siyuan
2018-11-23 12:00   ` Laszlo Ersek
2018-11-23 12:10   ` Laszlo Ersek
2018-11-23 12:19   ` Laszlo Ersek
2018-11-22  5:21 ` [PATCH v2 6/6] Vlv2TbltDevicePkg: " Fu Siyuan
2018-11-22  6:14 ` [PATCH v2 0/6] Add DSC/FDF include segment files for network stack Gao, Liming
2018-11-22 15:48   ` Laszlo Ersek
2018-11-23 16:02     ` Gao, Liming
2018-11-23 18:35       ` Laszlo Ersek
2018-11-26  3:31         ` Gao, Liming
2018-11-26 11:34           ` Laszlo Ersek
2018-11-22 16:12 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox