From e18aa8be8bec805d735927b52706bf3a122d8c78 Mon Sep 17 00:00:00 2001 From: pmikus Date: Mon, 17 Jun 2024 14:44:03 +0200 Subject: fix(trex): Add MTU Signed-off-by: Peter Mikus Change-Id: I91a3136a29192fb25ec4845e0924b96977f591f5 (cherry picked from commit a410c9fab12fd5d2087d5429860dfd9bcc49986b) --- resources/libraries/python/Constants.py | 2 ++ resources/libraries/python/TRexConfigGenerator.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 70452e6ff4..7e6d70b6cb 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -206,6 +206,8 @@ class Constants: # TRex number of cores in case multiple dual interface configurations. TREX_CORE_COUNT_MULTI = get_int_from_env("TREX_CORE_COUNT_MULTI", 8) + TREX_PORT_MTU = get_int_from_env("TREX_PORT_MTU", 0) + # TRex set number of RX/TX descriptors. # Set to 0 to use default values. TREX_TX_DESCRIPTORS_COUNT = get_int_from_env( diff --git a/resources/libraries/python/TRexConfigGenerator.py b/resources/libraries/python/TRexConfigGenerator.py index c50b42610c..4b9719b99e 100644 --- a/resources/libraries/python/TRexConfigGenerator.py +++ b/resources/libraries/python/TRexConfigGenerator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Cisco and/or its affiliates. +# Copyright (c) 2024 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -182,6 +182,15 @@ class TrexConfigGenerator: path = ["port_info"] self.add_config_item(self._node_config, value, path) + def add_port_mtu(self, value): + """Add port MTU configuration. + + :param value: Port MTU configuration. + :type value: int + """ + path = ["port_mtu"] + self.add_config_item(self._node_config, value, path) + def add_platform_master_thread_id(self, value): """Add platform master thread ID. @@ -291,6 +300,8 @@ class TrexConfig: trex_config.add_c(cores) trex_config.add_limit_memory(limit_memory) trex_config.add_port_info(port_info) + if Constants.TREX_PORT_MTU != 0: + trex_config.add_port_mtu(Constants.TREX_PORT_MTU) if Constants.TREX_RX_DESCRIPTORS_COUNT != 0: trex_config.add_rx_desc(Constants.TREX_RX_DESCRIPTORS_COUNT) if Constants.TREX_TX_DESCRIPTORS_COUNT != 0: -- cgit 1.2.3-korg