aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-06-09 09:45:26 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2022-06-10 11:21:09 +0000
commitc0da585c7ea862cf37d0e559200c8b45dc4eabdc (patch)
treee588a4e2c09c898c881e09dd66ae4b82373e69bc /resources
parent51da461dcdb1ed20abe73b616ceb971569c9b884 (diff)
fix(core): T-Rex initialization
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I53226ff6a345ac99c1e2e110712b2ff6197efe95
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/TrafficGenerator.py41
1 files changed, 30 insertions, 11 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 5d9a0568f1..2a28896e63 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -423,18 +423,37 @@ class TrafficGenerator(AbstractMeasurer):
tg_node, cmd, sudo=True, message=u"Kill TRex failed!"
)
- # Configure TRex.
- ports = ''
+ # Prepare interfaces for TRex.
+ mlx_ports = u""
+ mlx_driver = u""
+ itl_ports = u""
for port in tg_node[u"interfaces"].values():
- if u'Mellanox' not in port.get(u'model'):
- ports += f" {port.get(u'pci_address')}"
-
- cmd = f"sh -c \"cd {Constants.TREX_INSTALL_DIR}/scripts/ && " \
- f"./dpdk_nic_bind.py -u {ports} || true\""
- exec_cmd_no_error(
- tg_node, cmd, sudo=True,
- message=u"Unbind PCI ports from driver failed!"
- )
+ if u"Mellanox" in port.get(u"model"):
+ mlx_ports += f" {port.get(u'pci_address')}"
+ mlx_driver = port.get(u"driver")
+ if u"Intel" in port.get(u"model"):
+ itl_ports += f" {port.get(u'pci_address')}"
+
+ if itl_ports:
+ cmd = (
+ f"sh -c \"cd {Constants.TREX_INSTALL_DIR}/scripts/ && ",
+ f"./dpdk_nic_bind.py -u {itl_ports} || ",
+ f"true\""
+ )
+ exec_cmd_no_error(
+ tg_node, cmd, sudo=True,
+ message=u"Unbind PCI ports from driver failed!"
+ )
+ if mlx_ports:
+ cmd = (
+ f"sh -c \"cd {Constants.TREX_INSTALL_DIR}/scripts/ && ",
+ f"./dpdk_nic_bind.py -b {mlx_driver} {mlx_ports} || ",
+ f"true\""
+ )
+ exec_cmd_no_error(
+ tg_node, cmd, sudo=True,
+ message=u"Bind PCI ports from driver failed!"
+ )
# Start TRex.
cd_cmd = f"cd '{Constants.TREX_INSTALL_DIR}/scripts/'"