@@ -36,7 +36,7 @@ nodes:
use_first_core: false # tells DPDK to use any physical core
memory_channels: 4 # tells DPDK to use 4 memory channels
hugepages_2mb: # optional; if removed, will use system hugepage configuration
- amount: 256
+ number_of: 256
force_first_numa: false
ports:
# sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
peer_node: "SUT 1"
peer_pci: "0000:00:08.1"
hugepages_2mb: # optional; if removed, will use system hugepage configuration
- amount: 256
+ number_of: 256
force_first_numa: false
traffic_generator:
type: SCAPY
@@ -127,11 +127,11 @@ class HugepageConfiguration:
r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
Attributes:
- amount: The number of hugepages.
+ number_of: The number of hugepages to allocate.
force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
"""
- amount: int
+ number_of: int
force_first_numa: bool
@@ -150,9 +150,9 @@
"type": "object",
"description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
"properties": {
- "amount": {
+ "number_of": {
"type": "integer",
- "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+ "description": "The number of hugepages to configure. Hugepage size will be the system default."
},
"force_first_numa": {
"type": "boolean",
@@ -161,7 +161,7 @@
},
"additionalProperties": false,
"required": [
- "amount"
+ "number_of"
]
},
"mac_address": {
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
"""Allowed keys and values."""
#:
- amount: int
+ number_of: int
#:
force_first_numa: bool
@@ -84,9 +84,7 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
"""Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
return dpdk_prefix
- def setup_hugepages(
- self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
- ) -> None:
+ def setup_hugepages(self, number_of: int, hugepage_size: int, force_first_numa: bool) -> None:
"""Overrides :meth:`~.os_session.OSSession.setup_hugepages`."""
self._logger.info("Getting Hugepage information.")
hugepages_total = self._get_hugepages_total(hugepage_size)
@@ -97,10 +95,10 @@ def setup_hugepages(
raise ConfigurationError("hugepage size not supported by operating system")
self._numa_nodes = self._get_numa_nodes()
- if force_first_numa or hugepages_total < hugepage_count:
+ if force_first_numa or hugepages_total < number_of:
# when forcing numa, we need to clear existing hugepages regardless
# of size, so they can be moved to the first numa node
- self._configure_huge_pages(hugepage_count, hugepage_size, force_first_numa)
+ self._configure_huge_pages(number_of, hugepage_size, force_first_numa)
else:
self._logger.info("Hugepages already configured.")
self._mount_huge_pages()
@@ -138,7 +136,7 @@ def _supports_numa(self) -> bool:
# there's no reason to do any numa specific configuration)
return len(self._numa_nodes) > 1
- def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool) -> None:
+ def _configure_huge_pages(self, number_of: int, size: int, force_first_numa: bool) -> None:
self._logger.info("Configuring Hugepages.")
hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
if force_first_numa and self._supports_numa():
@@ -149,7 +147,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
f"/hugepages-{size}kB/nr_hugepages"
)
- self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+ self.send_command(f"echo {number_of} | tee {hugepage_config_path}", privileged=True)
def update_ports(self, ports: list[Port]) -> None:
"""Overrides :meth:`~.os_session.OSSession.update_ports`."""
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
"""
if self.config.hugepages:
self.main_session.setup_hugepages(
- self.config.hugepages.amount,
+ self.config.hugepages.number_of,
self.main_session.hugepage_size,
self.config.hugepages.force_first_numa,
)
@@ -347,18 +347,16 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
"""
@abstractmethod
- def setup_hugepages(
- self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
- ) -> None:
+ def setup_hugepages(self, number_of: int, hugepage_size: int, force_first_numa: bool) -> None:
"""Configure hugepages on the node.
Get the node's Hugepage Size, configure the specified count of hugepages
if needed and mount the hugepages if needed.
Args:
- hugepage_count: Configure this many hugepages.
+ number_of: Configure this many hugepages.
hugepage_size: Configure hugepages of this size.
- force_first_numa: If :data:`True`, configure hugepages just on the first numa node.
+ force_first_numa: If :data:`True`, configure just on the first numa node.
"""
@abstractmethod