Parametrize T-Rex rx/tx descriptors count 67/31767/16
authorTomas Alexy <tomas.alexy@pantheon.tech>
Thu, 25 Mar 2021 14:15:17 +0000 (15:15 +0100)
committerVratko Polak <vrpolak@cisco.com>
Fri, 26 Mar 2021 13:31:11 +0000 (13:31 +0000)
Additional configuration can provide performance boosts when running in virtual environments
If set to 0, uses default DPDK value
By tuning this value it's also possible to run T-Rex 2.88 with ENA NICs on AWS

Signed-off-by: Tomas Alexy <tomas.alexy@pantheon.tech>
Change-Id: I43c86ea1d9aa854a1087f07fe544ac77a5b80397

resources/libraries/python/Constants.py
resources/libraries/python/TrafficGenerator.py

index c21c5b8..8937e6c 100644 (file)
@@ -197,6 +197,11 @@ class Constants:
     # TRex number of cores
     TREX_CORE_COUNT = get_int_from_env(u"TREX_CORE_COUNT", 8)
 
+    # TRex set number of RX/TX descriptors
+    # Set to 0 to use default values
+    TREX_TX_DESCRIPTORS_COUNT = get_int_from_env(u"TREX_TX_DESCRIPTORS_COUNT", 0)
+    TREX_RX_DESCRIPTORS_COUNT = get_int_from_env(u"TREX_RX_DESCRIPTORS_COUNT", 0)
+
     # Trex force start regardless ports state
     TREX_SEND_FORCE = get_pessimistic_bool_from_env(u"TREX_SEND_FORCE")
 
index 9a9519e..c0d1b4e 100644 (file)
@@ -343,6 +343,24 @@ class TrafficGenerator(AbstractMeasurer):
                     f"EOF'",
                     sudo=True, message=u"T-Rex config generation!"
                 )
+
+                if Constants.TREX_RX_DESCRIPTORS_COUNT != 0:
+                    exec_cmd_no_error(
+                        self._node,
+                        f"sh -c 'cat << EOF >> /etc/trex_cfg.yaml\n"
+                        f"  rx_desc: {Constants.TREX_RX_DESCRIPTORS_COUNT}\n"
+                        f"EOF'",
+                        sudo=True, message=u"T-Rex rx_desc modification!"
+                    )
+
+                if Constants.TREX_TX_DESCRIPTORS_COUNT != 0:
+                    exec_cmd_no_error(
+                        self._node,
+                        f"sh -c 'cat << EOF >> /etc/trex_cfg.yaml\n"
+                        f"  tx_desc: {Constants.TREX_TX_DESCRIPTORS_COUNT}\n"
+                        f"EOF'",
+                        sudo=True, message=u"T-Rex tx_desc modification!"
+                    )
             else:
                 raise ValueError(u"Unknown OSI layer!")