DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Bailey <abailey@iol.unh.edu>
To: Patrick Robb <probb@iol.unh.edu>
Cc: Luca.Vizzarro@arm.com, dev@dpdk.org, Paul.Szczepanek@arm.com,
	 dmarx@iol.unh.edu, Nicholas Pratte <npratte@iol.unh.edu>
Subject: Re: [PATCH v6 1/3] dts: rework traffic generator inheritance structure
Date: Thu, 6 Nov 2025 08:37:31 -0500	[thread overview]
Message-ID: <CABJ3N2Ubi8DwHmNPYK1mgK_A+TAu5Rm6r-SueOYKBzzn6RLdng@mail.gmail.com> (raw)
In-Reply-To: <20251105223628.1659390-2-probb@iol.unh.edu>

[-- Attachment #1: Type: text/plain, Size: 7761 bytes --]

Reviewed-by: Andrew Bailey <abailey@iol.unh.edu>

On Wed, Nov 5, 2025 at 5:37 PM Patrick Robb <probb@iol.unh.edu> wrote:

> From: Nicholas Pratte <npratte@iol.unh.edu>
>
> Rework TG class hierarchy to include performance traffic generators.
> As such, methods specific to capturing traffic have been moved to the
> CapturingTrafficGenerator subclass.
>
> Bugzilla ID: 1697
> Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu>
> Signed-off-by: Patrick Robb <probb@iol.unh.edu>
> Reviewed-by: Dean Marx <dmarx@iol.unh.edu>
> Reviewed-by: Andrew Bailey <abailey@iol.unh.edu>
> ---
>  .../capturing_traffic_generator.py            | 34 +++++++++++
>  .../performance_traffic_generator.py          | 56 +++++++++++++++++++
>  .../traffic_generator/traffic_generator.py    | 38 -------------
>  3 files changed, 90 insertions(+), 38 deletions(-)
>  create mode 100644
> dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py
>
> diff --git
> a/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py
> b/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py
> index ec0993e6b7..734a66d1f3 100644
> ---
> a/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py
> +++
> b/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py
> @@ -65,6 +65,40 @@ def is_capturing(self) -> bool:
>          """This traffic generator can capture traffic."""
>          return True
>
> +    def send_packet(self, packet: Packet, port: Port) -> None:
> +        """Send `packet` and block until it is fully sent.
> +
> +        Send `packet` on `port`, then wait until `packet` is fully sent.
> +
> +        Args:
> +            packet: The packet to send.
> +            port: The egress port on the TG node.
> +        """
> +        self.send_packets([packet], port)
> +
> +    def send_packets(self, packets: list[Packet], port: Port) -> None:
> +        """Send `packets` and block until they are fully sent.
> +
> +        Send `packets` on `port`, then wait until `packets` are fully
> sent.
> +
> +        Args:
> +            packets: The packets to send.
> +            port: The egress port on the TG node.
> +        """
> +        self._logger.info(f"Sending packet{'s' if len(packets) > 1 else
> ''}.")
> +        self._logger.debug(get_packet_summaries(packets))
> +        self._send_packets(packets, port)
> +
> +    @abstractmethod
> +    def _send_packets(self, packets: list[Packet], port: Port) -> None:
> +        """The implementation of :method:`send_packets`.
> +
> +        The subclasses must implement this method which sends `packets`
> on `port`.
> +        The method should block until all `packets` are fully sent.
> +
> +        What fully sent means is defined by the traffic generator.
> +        """
> +
>      def send_packets_and_capture(
>          self,
>          packets: list[Packet],
> diff --git
> a/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py
> b/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py
> new file mode 100644
> index 0000000000..09abe9a66b
> --- /dev/null
> +++
> b/dts/framework/testbed_model/traffic_generator/performance_traffic_generator.py
> @@ -0,0 +1,56 @@
> +"""Traffic generators for performance tests which can generate a high
> number of packets."""
> +
> +from abc import abstractmethod
> +from dataclasses import dataclass
> +
> +from scapy.packet import Packet
> +
> +from .traffic_generator import TrafficGenerator
> +
> +
> +@dataclass(slots=True)
> +class PerformanceTrafficStats:
> +    """Data structure to store performance statistics for a given test
> run.
> +
> +    Attributes:
> +        tx_pps: Recorded tx packets per second.
> +        tx_bps: Recorded tx bytes per second.
> +        rx_pps: Recorded rx packets per second.
> +        rx_bps: Recorded rx bytes per second.
> +        frame_size: The total length of the frame.
> +    """
> +
> +    tx_pps: float
> +    tx_bps: float
> +    rx_pps: float
> +    rx_bps: float
> +
> +    frame_size: int | None = None
> +
> +
> +class PerformanceTrafficGenerator(TrafficGenerator):
> +    """An abstract base class for all performance-oriented traffic
> generators.
> +
> +    Provides an intermediary interface for performance-based traffic
> generator.
> +    """
> +
> +    @abstractmethod
> +    def calculate_traffic_and_stats(
> +        self,
> +        packet: Packet,
> +        duration: float,
> +        send_mpps: int | None = None,
> +    ) -> PerformanceTrafficStats:
> +        """Send packet traffic and acquire associated statistics.
> +
> +        If `send_mpps` is provided, attempt to transmit traffic at the
> `send_mpps` rate.
> +        Otherwise, attempt to transmit at line rate.
> +
> +        Args:
> +            packet: The packet to send.
> +            duration: Performance test duration (in seconds).
> +            send_mpps: The millions packets per second send rate.
> +
> +        Returns:
> +            Performance statistics of the generated test.
> +        """
> diff --git
> a/dts/framework/testbed_model/traffic_generator/traffic_generator.py
> b/dts/framework/testbed_model/traffic_generator/traffic_generator.py
> index cac119c183..e5f246df7a 100644
> --- a/dts/framework/testbed_model/traffic_generator/traffic_generator.py
> +++ b/dts/framework/testbed_model/traffic_generator/traffic_generator.py
> @@ -11,14 +11,10 @@
>  from abc import ABC, abstractmethod
>  from typing import Any
>
> -from scapy.packet import Packet
> -
>  from framework.config.test_run import TrafficGeneratorConfig
>  from framework.logger import DTSLogger, get_dts_logger
>  from framework.testbed_model.node import Node
> -from framework.testbed_model.port import Port
>  from framework.testbed_model.topology import Topology
> -from framework.utils import get_packet_summaries
>
>
>  class TrafficGenerator(ABC):
> @@ -57,40 +53,6 @@ def teardown(self) -> None:
>          """Teardown the traffic generator."""
>          self.close()
>
> -    def send_packet(self, packet: Packet, port: Port) -> None:
> -        """Send `packet` and block until it is fully sent.
> -
> -        Send `packet` on `port`, then wait until `packet` is fully sent.
> -
> -        Args:
> -            packet: The packet to send.
> -            port: The egress port on the TG node.
> -        """
> -        self.send_packets([packet], port)
> -
> -    def send_packets(self, packets: list[Packet], port: Port) -> None:
> -        """Send `packets` and block until they are fully sent.
> -
> -        Send `packets` on `port`, then wait until `packets` are fully
> sent.
> -
> -        Args:
> -            packets: The packets to send.
> -            port: The egress port on the TG node.
> -        """
> -        self._logger.info(f"Sending packet{'s' if len(packets) > 1 else
> ''}.")
> -        self._logger.debug(get_packet_summaries(packets))
> -        self._send_packets(packets, port)
> -
> -    @abstractmethod
> -    def _send_packets(self, packets: list[Packet], port: Port) -> None:
> -        """The implementation of :method:`send_packets`.
> -
> -        The subclasses must implement this method which sends `packets`
> on `port`.
> -        The method should block until all `packets` are fully sent.
> -
> -        What fully sent means is defined by the traffic generator.
> -        """
> -
>      @property
>      def is_capturing(self) -> bool:
>          """This traffic generator can't capture traffic."""
> --
> 2.49.0
>
>

[-- Attachment #2: Type: text/html, Size: 9745 bytes --]

  reply	other threads:[~2025-11-06 13:37 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 19:40 [RFC Patch v1 0/5] Add TREX Traffic Generator to DTS Framework Nicholas Pratte
2025-04-23 19:40 ` [RFC Patch v1 1/5] dts: rework config module to support perf TGs Nicholas Pratte
2025-04-23 19:40 ` [RFC Patch v1 2/5] dts: rework traffic generator inheritance structure Nicholas Pratte
2025-05-15 19:24   ` Patrick Robb
2025-05-16 19:12     ` Nicholas Pratte
2025-04-23 19:40 ` [RFC Patch v1 3/5] dts: add asychronous support to ssh sessions Nicholas Pratte
2025-05-15 19:24   ` Patrick Robb
2025-04-23 19:40 ` [RFC Patch v1 4/5] dts: add trex traffic generator to dts framework Nicholas Pratte
2025-05-15 19:25   ` Patrick Robb
2025-05-16 19:45     ` Nicholas Pratte
2025-04-23 19:40 ` [RFC Patch v1 5/5] dts: add performance test functions to test suite api Nicholas Pratte
2025-05-15 19:25   ` Patrick Robb
2025-05-16 20:18 ` [RFC v2 0/6] Add TREX Traffic Generator to DTS Framework Nicholas Pratte
2025-05-16 20:18   ` [RFC v2 1/6] dts: rework config module to support perf TGs Nicholas Pratte
2025-05-20 20:33     ` Dean Marx
2025-05-16 20:18   ` [RFC v2 2/6] dts: rework traffic generator inheritance structure Nicholas Pratte
2025-05-21 20:36     ` Dean Marx
2025-05-16 20:18   ` [RFC v2 3/6] dts: add asynchronous support to ssh sessions Nicholas Pratte
2025-05-22 15:04     ` Dean Marx
2025-05-16 20:18   ` [RFC v2 4/6] dts: add extended timeout option to interactive shells Nicholas Pratte
2025-05-22 15:10     ` Dean Marx
2025-05-16 20:18   ` [RFC v2 5/6] dts: add trex traffic generator to dts framework Nicholas Pratte
2025-05-22 16:55     ` Dean Marx
2025-05-16 20:18   ` [RFC v2 6/6] dts: add performance test functions to test suite api Nicholas Pratte
2025-05-22 17:54     ` Dean Marx
2025-07-02  5:21 ` [PATCH v3 1/5] dts: rework config module to support perf TGs Patrick Robb
2025-07-02  5:21   ` [PATCH v3 2/5] dts: rework traffic generator inheritance structure Patrick Robb
2025-07-02 15:31     ` Luca Vizzarro
2025-07-02  5:21   ` [PATCH v3 3/5] dts: add timeout override option to interactive shells Patrick Robb
2025-07-02 15:33     ` Luca Vizzarro
2025-07-02  5:21   ` [PATCH v3 4/5] dts: add trex traffic generator to dts framework Patrick Robb
2025-07-02 16:32     ` Luca Vizzarro
2025-07-02  5:21   ` [PATCH v3 5/5] dts: add performance test functions to test suite API Patrick Robb
2025-07-02 16:37     ` Luca Vizzarro
2025-07-02 15:09   ` [PATCH v3 1/5] dts: rework config module to support perf TGs Luca Vizzarro
2025-10-01 23:16 ` [PATCH v4 0/3] Add TREX Traffic Generator to DTS Framework Patrick Robb
2025-10-01 23:16   ` [PATCH v4 1/3] dts: rework traffic generator inheritance structure Patrick Robb
2025-10-08 11:45     ` Luca Vizzarro
2025-10-08 16:34       ` Patrick Robb
2025-10-01 23:16   ` [PATCH v4 2/3] dts: add trex traffic generator to dts framework Patrick Robb
2025-10-01 23:16   ` [PATCH v4 3/3] dts: add performance test functions to test suite API Patrick Robb
2025-10-10 18:41     ` Dean Marx
2025-10-23  1:30   ` [PATCH v5 0/3] Add TREX Traffic Generator to DTS Framework Patrick Robb
2025-10-23  1:30     ` [PATCH v5 1/3] dts: rework traffic generator inheritance structure Patrick Robb
2025-10-30 14:41       ` Andrew Bailey
2025-10-23  1:30     ` [PATCH v5 2/3] dts: add trex traffic generator to dts framework Patrick Robb
2025-10-30 14:46       ` Andrew Bailey
2025-10-23  1:30     ` [PATCH v5 3/3] dts: add performance test functions to test suite API Patrick Robb
2025-10-30 14:53       ` Andrew Bailey
2025-11-05 22:36     ` [PATCH v6 0/3] Add TREX Traffic Generator to DTS Framework Patrick Robb
2025-11-05 22:36       ` [PATCH v6 1/3] dts: rework traffic generator inheritance structure Patrick Robb
2025-11-06 13:37         ` Andrew Bailey [this message]
2025-11-05 22:36       ` [PATCH v6 2/3] dts: add trex traffic generator to dts framework Patrick Robb
2025-11-06 13:33         ` Andrew Bailey
2025-11-05 22:36       ` [PATCH v6 3/3] dts: add performance test functions to test suite API Patrick Robb
2025-11-06 13:30         ` Andrew Bailey
2025-11-06 15:25           ` Andrew Bailey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABJ3N2Ubi8DwHmNPYK1mgK_A+TAu5Rm6r-SueOYKBzzn6RLdng@mail.gmail.com \
    --to=abailey@iol.unh.edu \
    --cc=Luca.Vizzarro@arm.com \
    --cc=Paul.Szczepanek@arm.com \
    --cc=dev@dpdk.org \
    --cc=dmarx@iol.unh.edu \
    --cc=npratte@iol.unh.edu \
    --cc=probb@iol.unh.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).