diff options
author | pmikus <peter.mikus@protonmail.ch> | 2023-10-05 12:27:08 +0000 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2023-10-09 12:09:10 +0000 |
commit | c3ce59c652caaee06b3090f387f8826c15102703 (patch) | |
tree | 8665d3acd3c5c69baa0b329ff65217fb569b5e91 /resources/libraries/python/TRexConfigGenerator.py | |
parent | 68f39d30d623b95dfe13a20d73313b7c173eec2a (diff) |
feat(trex): Multilink
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch>
Change-Id: I36c5d175a34555ad9ce88d69a824f366b54dbc81
Diffstat (limited to 'resources/libraries/python/TRexConfigGenerator.py')
-rw-r--r-- | resources/libraries/python/TRexConfigGenerator.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/resources/libraries/python/TRexConfigGenerator.py b/resources/libraries/python/TRexConfigGenerator.py index e5ac19647f..c73e24960a 100644 --- a/resources/libraries/python/TRexConfigGenerator.py +++ b/resources/libraries/python/TRexConfigGenerator.py @@ -225,12 +225,12 @@ class TrexConfigGenerator: exec_cmd_no_error(self._node, command, message=message) -class TrexInitConfig: - """TRex Initial Configuration. +class TrexConfig: + """TRex Configuration Class. """ @staticmethod - def init_trex_startup_configuration(node, tg_topology): - """Apply initial TRex startup configuration. + def add_startup_configuration(node, tg_topology): + """Apply TRex startup configuration. :param node: TRex node in the topology. :param tg_topology: Ordered TRex links. @@ -243,16 +243,24 @@ class TrexInitConfig: master_thread_id = None latency_thread_id = None cores = None - limit_memory = f"{Constants.TREX_LIMIT_MEMORY}" sockets = list() - for link in tg_topology: + for idx, link in enumerate(tg_topology): pci_addresses.append( Topology().get_interface_pci_addr(node, link["interface"]) ) + if len(tg_topology) > 2: + # Multiple dual_ifs must not share the cores. + tg_dtc = Constants.TREX_CORE_COUNT_MULTI + tg_dtc_offset = Constants.TREX_CORE_COUNT_MULTI * (idx // 2) + else: + # Single dual_if can share cores. + tg_dtc = Constants.TREX_CORE_COUNT + tg_dtc_offset = 0 master_thread_id, latency_thread_id, socket, threads = \ CpuUtils.get_affinity_trex( - node, link["interface"], tg_dtc=Constants.TREX_CORE_COUNT + node, link["interface"], tg_dtc=tg_dtc, + tg_dtc_offset=tg_dtc_offset ) dual_if.append(dict(socket=socket, threads=threads)) cores = len(threads) @@ -265,10 +273,16 @@ class TrexInitConfig: ) ) sockets.append(socket) - if 0 in sockets and 1 in sockets: + + limit_memory = f"{Constants.TREX_LIMIT_MEMORY}" + if len(tg_topology) <= 2 and 0 in sockets and 1 in sockets: limit_memory = ( f"{Constants.TREX_LIMIT_MEMORY},{Constants.TREX_LIMIT_MEMORY}" ) + if len(tg_topology) > 2: + limit_memory = ( + f"{Constants.TREX_LIMIT_MEMORY_MULTI}" + ) trex_config = TrexConfigGenerator() trex_config.set_node(node) |