fix(trex): Add MTU 25/41125/1
authorpmikus <[email protected]>
Mon, 17 Jun 2024 12:44:03 +0000 (14:44 +0200)
committerPeter Mikus <[email protected]>
Tue, 18 Jun 2024 08:18:56 +0000 (08:18 +0000)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: I91a3136a29192fb25ec4845e0924b96977f591f5
(cherry picked from commit a410c9fab12fd5d2087d5429860dfd9bcc49986b)

resources/libraries/python/Constants.py
resources/libraries/python/TRexConfigGenerator.py

index 70452e6..7e6d70b 100644 (file)
@@ -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(
index c50b426..4b9719b 100644 (file)
@@ -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: