DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 0/7] dts: Port scatter suite over
@ 2023-11-09 23:07 jspewock
  2023-11-09 23:07 ` [PATCH v1 1/7] dts: Add scatter test suite jspewock
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

This patch ports over the functionality of the scatter testing suite
from "old dts." The idea of the suite is the coverage it provides should
be parity with the ethdev testing suite in old DTS.

Depends-on: series-30228 ("dts: Add the ability to bind ports to drivers")

Jeremy Spewock (7):
  dts: Add scatter test suite
  dts: add waiting for port up in testpmd
  dts: add scatter to the yaml schema
  dts: allow passing parameters into interactive apps
  dts: add optional packet filtering to scapy sniffer
  dts: add pci addresses to EAL parameters
  dts: allow configuring MTU of ports

 dts/framework/config/conf_yaml_schema.json    |  3 +-
 dts/framework/remote_session/linux_session.py |  7 ++
 dts/framework/remote_session/os_session.py    |  9 ++
 .../remote_session/remote/testpmd_shell.py    | 31 ++++++-
 dts/framework/test_suite.py                   | 13 ++-
 .../capturing_traffic_generator.py            | 12 ++-
 dts/framework/testbed_model/scapy.py          | 11 ++-
 dts/framework/testbed_model/sut_node.py       | 20 ++++-
 dts/framework/testbed_model/tg_node.py        |  4 +-
 dts/tests/TestSuite_scatter.py                | 85 +++++++++++++++++++
 10 files changed, 184 insertions(+), 11 deletions(-)
 create mode 100644 dts/tests/TestSuite_scatter.py

-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/7] dts: Add scatter test suite
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 2/7] dts: add waiting for port up in testpmd jspewock
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

This test suite provides testing the support of scattered packets by
Poll Mode Drivers using testpmd. It incorporates 5 different test cases
which test the sending and receiving of packets with lengths that are
less than the mbuf data buffer size, the same as the mbuf data buffer
size, and the mbuf data buffer size plus 1, 4, and 5. The goal of this
test suite is to align with the existing dts test plan for scattered
packets within DTS.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/tests/TestSuite_scatter.py | 85 ++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 dts/tests/TestSuite_scatter.py

diff --git a/dts/tests/TestSuite_scatter.py b/dts/tests/TestSuite_scatter.py
new file mode 100644
index 0000000000..0adaad1b2c
--- /dev/null
+++ b/dts/tests/TestSuite_scatter.py
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 University of New Hampshire
+
+import struct
+
+from scapy.layers.inet import IP  # type: ignore[import]
+from scapy.layers.l2 import Ether  # type: ignore[import]
+from scapy.packet import Raw  # type: ignore[import]
+from scapy.utils import hexstr  # type: ignore[import]
+
+from framework.remote_session import TestPmdShell
+from framework.test_suite import TestSuite
+
+
+class Scatter(TestSuite):
+    mbsize: int
+
+    def set_up_suite(self) -> None:
+        self.verify(
+            len(self._port_links) > 1,
+            "Must have at least two port links to run scatter",
+        )
+        if self._sut_port_egress.os_driver in ["i40e", "ixgbe", "ice"]:
+            self.mbsize = 2048
+        else:
+            self.mbsize = 1024
+
+        self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_egress)
+        self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_ingress)
+
+    def scatter_pktgen_send_packet(self, pktsize: int) -> str:
+        """Generate and send packet to the SUT.
+
+        Functional test for scatter packets.
+
+        Args:
+            pktsize: Size of the packet to generate and send.
+        """
+        packet = Ether() / IP() / Raw()
+        packet.getlayer(2).load = ""
+        payload_len = pktsize - len(packet) - 4
+        payload = ["58"] * payload_len
+        # pack the payload
+        for X_in_hex in payload:
+            packet.load += struct.pack(
+                "=B", int("%s%s" % (X_in_hex[0], X_in_hex[1]), 16)
+            )
+        received_packets = self.send_packet_and_capture(packet)
+        self.verify(len(received_packets) > 0, "Did not receive any packets.")
+        load = hexstr(received_packets[0].getlayer(2), onlyhex=1)
+
+        return load
+
+    def test_scatter_mbuf_2048(self) -> None:
+        """
+        Test:
+            Start testpmd and run functional test with preset mbsize.
+        """
+        testpmd = self.sut_node.create_interactive_shell(
+            TestPmdShell,
+            app_parameters=(
+                "--mbcache=200 "
+                f"--mbuf-size={self.mbsize} "
+                "--max-pkt-len=9000 "
+                "--port-topology=paired "
+                "--tx-offloads=0x00008000"
+            ),
+            privileged=True,
+        )
+        testpmd.send_command("set fwd mac")
+        testpmd.send_command("start")
+        link_is_up = testpmd.wait_link_status_up(0) and testpmd.wait_link_status_up(1)
+        self.verify(link_is_up, "Links never came up in TestPMD.")
+
+        for offset in [-1, 0, 1, 4, 5]:
+            recv_payload = self.scatter_pktgen_send_packet(self.mbsize + offset)
+            self.verify(
+                ("58 " * 8).strip() in recv_payload,
+                "Received packet had incorrect payload",
+            )
+        testpmd.send_command("stop")
+
+    def tear_down_suite(self) -> None:
+        self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_egress)
+        self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_ingress)
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 2/7] dts: add waiting for port up in testpmd
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
  2023-11-09 23:07 ` [PATCH v1 1/7] dts: Add scatter test suite jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 3/7] dts: add scatter to the yaml schema jspewock
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Added a method within the testpmd interactive shell that polls the
status of ports and verifies that the link status on a given port is
"up." Polling will continue until either the link comes up, or the
timeout is reached.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 .../remote_session/remote/testpmd_shell.py    | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/dts/framework/remote_session/remote/testpmd_shell.py b/dts/framework/remote_session/remote/testpmd_shell.py
index 1455b5a199..3ea16c7ab3 100644
--- a/dts/framework/remote_session/remote/testpmd_shell.py
+++ b/dts/framework/remote_session/remote/testpmd_shell.py
@@ -1,9 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 University of New Hampshire
 
+import time
 from pathlib import PurePath
 from typing import Callable
 
+from framework.settings import SETTINGS
+
 from .interactive_shell import InteractiveShell
 
 
@@ -47,3 +50,29 @@ def get_devices(self) -> list[TestPmdDevice]:
             if "device name:" in line.lower():
                 dev_list.append(TestPmdDevice(line))
         return dev_list
+
+    def wait_link_status_up(self, port_id: int, timeout=SETTINGS.timeout) -> bool:
+        """Wait until the link status on the given port is "up".
+
+        Arguments:
+            port_id: Port to check the link status on.
+            timeout: time to wait for the link to come up.
+
+        Returns:
+            If the link came up in time or not.
+        """
+        time_to_stop = time.time() + timeout
+        while time.time() < time_to_stop:
+            port_info = self.send_command(f"show port info {port_id}")
+            if "Link status: up" in port_info:
+                break
+            time.sleep(0.5)
+        else:
+            self._logger.error(
+                f"The link for port {port_id} did not come up in the given timeout."
+            )
+        return "Link status: up" in port_info
+
+    def close(self) -> None:
+        self.send_command("exit", "")
+        return super().close()
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 3/7] dts: add scatter to the yaml schema
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
  2023-11-09 23:07 ` [PATCH v1 1/7] dts: Add scatter test suite jspewock
  2023-11-09 23:07 ` [PATCH v1 2/7] dts: add waiting for port up in testpmd jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 4/7] dts: allow passing parameters into interactive apps jspewock
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Allow for scatter to be specificed in the configuration file.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/config/conf_yaml_schema.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index 84e45fe3c2..97ee32f47a 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -186,7 +186,8 @@
       "type": "string",
       "enum": [
         "hello_world",
-        "os_udp"
+        "os_udp",
+        "scatter"
       ]
     },
     "test_target": {
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 4/7] dts: allow passing parameters into interactive apps
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
                   ` (2 preceding siblings ...)
  2023-11-09 23:07 ` [PATCH v1 3/7] dts: add scatter to the yaml schema jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 5/7] dts: add optional packet filtering to scapy sniffer jspewock
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Modified interactive applications to allow for the ability to pass
parameters into the app on start up. Also modified the way EAL
parameters are handled so that the trailing "--" separator is added be
default after all EAL parameters.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/remote_session/remote/testpmd_shell.py |  2 +-
 dts/framework/testbed_model/sut_node.py              | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dts/framework/remote_session/remote/testpmd_shell.py b/dts/framework/remote_session/remote/testpmd_shell.py
index 3ea16c7ab3..3f6a86aa35 100644
--- a/dts/framework/remote_session/remote/testpmd_shell.py
+++ b/dts/framework/remote_session/remote/testpmd_shell.py
@@ -32,7 +32,7 @@ def _start_application(
         self, get_privileged_command: Callable[[str], str] | None
     ) -> None:
         """See "_start_application" in InteractiveShell."""
-        self._app_args += " -- -i"
+        self._app_args += " -i"
         super()._start_application(get_privileged_command)
 
     def get_devices(self) -> list[TestPmdDevice]:
diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py
index 4161d3a4d5..bcac939e72 100644
--- a/dts/framework/testbed_model/sut_node.py
+++ b/dts/framework/testbed_model/sut_node.py
@@ -377,7 +377,8 @@ def create_interactive_shell(
         shell_cls: Type[InteractiveShellType],
         timeout: float = SETTINGS.timeout,
         privileged: bool = False,
-        eal_parameters: EalParameters | str | None = None,
+        eal_parameters: EalParameters | str = "",
+        app_parameters: str = "",
     ) -> InteractiveShellType:
         """Factory method for creating a handler for an interactive session.
 
@@ -392,12 +393,14 @@ def create_interactive_shell(
             eal_parameters: List of EAL parameters to use to launch the app. If this
                 isn't provided or an empty string is passed, it will default to calling
                 create_eal_parameters().
+            app_parameters: Additional arguments to pass into the application on the
+                command-line.
         Returns:
             Instance of the desired interactive application.
         """
-        if not eal_parameters:
+        if not eal_parameters and shell_cls.dpdk_app:
             eal_parameters = self.create_eal_parameters()
-
+            eal_parameters = f"{eal_parameters} --"
         # We need to append the build directory for DPDK apps
         if shell_cls.dpdk_app:
             shell_cls.path = self.main_session.join_remote_path(
@@ -405,7 +408,7 @@ def create_interactive_shell(
             )
 
         return super().create_interactive_shell(
-            shell_cls, timeout, privileged, str(eal_parameters)
+            shell_cls, timeout, privileged, f"{eal_parameters} {app_parameters}"
         )
 
     def bind_ports_to_driver(self, for_dpdk: bool = True) -> None:
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 5/7] dts: add optional packet filtering to scapy sniffer
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
                   ` (3 preceding siblings ...)
  2023-11-09 23:07 ` [PATCH v1 4/7] dts: allow passing parameters into interactive apps jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 6/7] dts: add pci addresses to EAL parameters jspewock
  2023-11-09 23:07 ` [PATCH v1 7/7] dts: allow configuring MTU of ports jspewock
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Added the options to filter out LLDP and ARP packets when
sniffing for packets with scapy. This was done using BPF filters to
ensure that the noise these packets provide does not interfere with test
cases.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/test_suite.py                         | 13 +++++++++++--
 .../testbed_model/capturing_traffic_generator.py    | 12 +++++++++++-
 dts/framework/testbed_model/scapy.py                | 11 ++++++++++-
 dts/framework/testbed_model/tg_node.py              |  4 +++-
 4 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 3b890c0451..3222f172f3 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -152,7 +152,11 @@ def _configure_ipv4_forwarding(self, enable: bool) -> None:
         self.sut_node.configure_ipv4_forwarding(enable)
 
     def send_packet_and_capture(
-        self, packet: Packet, duration: float = 1
+        self,
+        packet: Packet,
+        duration: float = 1,
+        no_lldp: bool = True,
+        no_arp: bool = True,
     ) -> list[Packet]:
         """
         Send a packet through the appropriate interface and
@@ -162,7 +166,12 @@ def send_packet_and_capture(
         """
         packet = self._adjust_addresses(packet)
         return self.tg_node.send_packet_and_capture(
-            packet, self._tg_port_egress, self._tg_port_ingress, duration
+            packet,
+            self._tg_port_egress,
+            self._tg_port_ingress,
+            duration,
+            no_lldp,
+            no_arp,
         )
 
     def get_expected_packet(self, packet: Packet) -> Packet:
diff --git a/dts/framework/testbed_model/capturing_traffic_generator.py b/dts/framework/testbed_model/capturing_traffic_generator.py
index ab98987f8e..0a0d0f7d0d 100644
--- a/dts/framework/testbed_model/capturing_traffic_generator.py
+++ b/dts/framework/testbed_model/capturing_traffic_generator.py
@@ -52,6 +52,8 @@ def send_packet_and_capture(
         send_port: Port,
         receive_port: Port,
         duration: float,
+        no_lldp: bool,
+        no_arp: bool,
         capture_name: str = _get_default_capture_name(),
     ) -> list[Packet]:
         """Send a packet, return received traffic.
@@ -71,7 +73,7 @@ def send_packet_and_capture(
              A list of received packets. May be empty if no packets are captured.
         """
         return self.send_packets_and_capture(
-            [packet], send_port, receive_port, duration, capture_name
+            [packet], send_port, receive_port, duration, no_lldp, no_arp, capture_name
         )
 
     def send_packets_and_capture(
@@ -80,6 +82,8 @@ def send_packets_and_capture(
         send_port: Port,
         receive_port: Port,
         duration: float,
+        no_lldp: bool,
+        no_arp: bool,
         capture_name: str = _get_default_capture_name(),
     ) -> list[Packet]:
         """Send packets, return received traffic.
@@ -93,6 +97,8 @@ def send_packets_and_capture(
             send_port: The egress port on the TG node.
             receive_port: The ingress port in the TG node.
             duration: Capture traffic for this amount of time after sending the packets.
+            no_lldp: Option to disable capturing LLDP packets
+            no_arp: Option to disable capturing ARP packets
             capture_name: The name of the .pcap file where to store the capture.
 
         Returns:
@@ -108,6 +114,8 @@ def send_packets_and_capture(
             send_port,
             receive_port,
             duration,
+            no_lldp,
+            no_arp,
         )
 
         self._logger.debug(
@@ -123,6 +131,8 @@ def _send_packets_and_capture(
         send_port: Port,
         receive_port: Port,
         duration: float,
+        no_lldp: bool,
+        no_arp: bool,
     ) -> list[Packet]:
         """
         The extended classes must implement this method which
diff --git a/dts/framework/testbed_model/scapy.py b/dts/framework/testbed_model/scapy.py
index af0d4dbb25..58f01af21a 100644
--- a/dts/framework/testbed_model/scapy.py
+++ b/dts/framework/testbed_model/scapy.py
@@ -69,6 +69,7 @@ def scapy_send_packets_and_capture(
     send_iface: str,
     recv_iface: str,
     duration: float,
+    sniff_filter: str,
 ) -> list[bytes]:
     """RPC function to send and capture packets.
 
@@ -90,6 +91,7 @@ def scapy_send_packets_and_capture(
         iface=recv_iface,
         store=True,
         started_callback=lambda *args: scapy.all.sendp(scapy_packets, iface=send_iface),
+        filter=sniff_filter,
     )
     sniffer.start()
     time.sleep(duration)
@@ -264,10 +266,16 @@ def _send_packets_and_capture(
         send_port: Port,
         receive_port: Port,
         duration: float,
+        no_lldp: bool,
+        no_arp: bool,
         capture_name: str = _get_default_capture_name(),
     ) -> list[Packet]:
         binary_packets = [packet.build() for packet in packets]
-
+        sniff_filter = []
+        if no_lldp:
+            sniff_filter.append("ether[12:2] != 0x88cc")
+        if no_arp:
+            sniff_filter.append("ether[12:2] != 0x0806")
         xmlrpc_packets: list[
             xmlrpc.client.Binary
         ] = self.rpc_server_proxy.scapy_send_packets_and_capture(
@@ -275,6 +283,7 @@ def _send_packets_and_capture(
             send_port.logical_name,
             receive_port.logical_name,
             duration,
+            " && ".join(sniff_filter),
         )  # type: ignore[assignment]
 
         scapy_packets = [Ether(packet.data) for packet in xmlrpc_packets]
diff --git a/dts/framework/testbed_model/tg_node.py b/dts/framework/testbed_model/tg_node.py
index 27025cfa31..98e55b7831 100644
--- a/dts/framework/testbed_model/tg_node.py
+++ b/dts/framework/testbed_model/tg_node.py
@@ -56,6 +56,8 @@ def send_packet_and_capture(
         send_port: Port,
         receive_port: Port,
         duration: float = 1,
+        no_lldp: bool = True,
+        no_arp: bool = True,
     ) -> list[Packet]:
         """Send a packet, return received traffic.
 
@@ -73,7 +75,7 @@ def send_packet_and_capture(
              A list of received packets. May be empty if no packets are captured.
         """
         return self.traffic_generator.send_packet_and_capture(
-            packet, send_port, receive_port, duration
+            packet, send_port, receive_port, duration, no_lldp, no_arp
         )
 
     def close(self) -> None:
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 6/7] dts: add pci addresses to EAL parameters
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
                   ` (4 preceding siblings ...)
  2023-11-09 23:07 ` [PATCH v1 5/7] dts: add optional packet filtering to scapy sniffer jspewock
@ 2023-11-09 23:07 ` jspewock
  2023-11-09 23:07 ` [PATCH v1 7/7] dts: allow configuring MTU of ports jspewock
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Added allow list to the EAL parameters created in DTS to ensure that
only the relevent PCI devices are considered when launching DPDK
applications.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/testbed_model/sut_node.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py
index bcac939e72..f9c7bd9bf3 100644
--- a/dts/framework/testbed_model/sut_node.py
+++ b/dts/framework/testbed_model/sut_node.py
@@ -20,6 +20,7 @@
 from framework.utils import MesonArgs
 
 from .hw import LogicalCoreCount, LogicalCoreList, VirtualDevice
+from .hw.port import Port
 from .node import Node
 
 
@@ -31,6 +32,7 @@ def __init__(
         prefix: str,
         no_pci: bool,
         vdevs: list[VirtualDevice],
+        ports: list[Port],
         other_eal_param: str,
     ):
         """
@@ -56,6 +58,7 @@ def __init__(
             self._prefix = f"--file-prefix={prefix}"
         self._no_pci = "--no-pci" if no_pci else ""
         self._vdevs = " ".join(f"--vdev {vdev}" for vdev in vdevs)
+        self._ports = " ".join(f"-a {port.pci}" for port in ports)
         self._other_eal_param = other_eal_param
 
     def __str__(self) -> str:
@@ -65,6 +68,7 @@ def __str__(self) -> str:
             f"{self._prefix} "
             f"{self._no_pci} "
             f"{self._vdevs} "
+            f"{self._ports} "
             f"{self._other_eal_param}"
         )
 
@@ -308,6 +312,7 @@ def create_eal_parameters(
         append_prefix_timestamp: bool = True,
         no_pci: bool = False,
         vdevs: list[VirtualDevice] = None,
+        ports: list[Port] | None = None,
         other_eal_param: str = "",
     ) -> "EalParameters":
         """
@@ -350,12 +355,16 @@ def create_eal_parameters(
         if vdevs is None:
             vdevs = []
 
+        if ports is None:
+            ports = self.ports
+
         return EalParameters(
             lcore_list=lcore_list,
             memory_channels=self.config.memory_channels,
             prefix=prefix,
             no_pci=no_pci,
             vdevs=vdevs,
+            ports=ports,
             other_eal_param=other_eal_param,
         )
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 7/7] dts: allow configuring MTU of ports
  2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
                   ` (5 preceding siblings ...)
  2023-11-09 23:07 ` [PATCH v1 6/7] dts: add pci addresses to EAL parameters jspewock
@ 2023-11-09 23:07 ` jspewock
  6 siblings, 0 replies; 8+ messages in thread
From: jspewock @ 2023-11-09 23:07 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, thomas, wathsala.vithanage,
	probb, paul.szczepanek, yoan.picchi, ferruh.yigit,
	andrew.rybchenko
  Cc: dev, Jeremy Spewock

From: Jeremy Spewock <jspewock@iol.unh.edu>

Adds methods in both os_session and linux session to allow for setting
MTU of port interfaces in an OS agnostic way.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/remote_session/linux_session.py | 7 +++++++
 dts/framework/remote_session/os_session.py    | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/dts/framework/remote_session/linux_session.py b/dts/framework/remote_session/linux_session.py
index a3f1a6bf3b..dab68d41b1 100644
--- a/dts/framework/remote_session/linux_session.py
+++ b/dts/framework/remote_session/linux_session.py
@@ -196,6 +196,13 @@ def configure_port_ip_address(
             verify=True,
         )
 
+    def configure_port_mtu(self, mtu: int, port: Port) -> None:
+        self.send_command(
+            f"ip link set dev {port.logical_name} mtu {mtu}",
+            privileged=True,
+            verify=True,
+        )
+
     def configure_ipv4_forwarding(self, enable: bool) -> None:
         state = 1 if enable else 0
         self.send_command(f"sysctl -w net.ipv4.ip_forward={state}", privileged=True)
diff --git a/dts/framework/remote_session/os_session.py b/dts/framework/remote_session/os_session.py
index 8a709eac1c..c038f78b79 100644
--- a/dts/framework/remote_session/os_session.py
+++ b/dts/framework/remote_session/os_session.py
@@ -277,6 +277,15 @@ def configure_port_ip_address(
         Configure (add or delete) an IP address of the input port.
         """
 
+    @abstractmethod
+    def configure_port_mtu(self, mtu: int, port: Port) -> None:
+        """Configure MTU on a given port.
+
+        Args:
+            mtu: Desired MTU value.
+            port: Port to set the MTU on.
+        """
+
     @abstractmethod
     def configure_ipv4_forwarding(self, enable: bool) -> None:
         """
-- 
2.42.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-09 23:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 23:07 [PATCH v1 0/7] dts: Port scatter suite over jspewock
2023-11-09 23:07 ` [PATCH v1 1/7] dts: Add scatter test suite jspewock
2023-11-09 23:07 ` [PATCH v1 2/7] dts: add waiting for port up in testpmd jspewock
2023-11-09 23:07 ` [PATCH v1 3/7] dts: add scatter to the yaml schema jspewock
2023-11-09 23:07 ` [PATCH v1 4/7] dts: allow passing parameters into interactive apps jspewock
2023-11-09 23:07 ` [PATCH v1 5/7] dts: add optional packet filtering to scapy sniffer jspewock
2023-11-09 23:07 ` [PATCH v1 6/7] dts: add pci addresses to EAL parameters jspewock
2023-11-09 23:07 ` [PATCH v1 7/7] dts: allow configuring MTU of ports jspewock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).