From 67fcb88ef4e15bc498d4c5c3b2ba7089890c60d2 Mon Sep 17 00:00:00 2001 From: "Matthew McGovern (LINUX)" Date: Wed, 12 Nov 2025 17:07:06 -0800 Subject: [PATCH 1/2] dpdk: testpmd check packet drops Gathers and checks packet drops at the end of send receive tests. Senders are allowed to drop more packets, we intentionally tune it to maximize the PPS, so some drops are expected. The rough metric in this PR is that the percentage of packets dropped should not exceed 20% on the sender and 1% on the receiver. --- lisa/microsoft/testsuites/dpdk/dpdktestpmd.py | 40 +++++++++++++++++++ lisa/microsoft/testsuites/dpdk/dpdkutil.py | 6 +++ 2 files changed, 46 insertions(+) diff --git a/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py b/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py index 8febbbb443..3ef4e46c98 100644 --- a/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py +++ b/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py @@ -411,10 +411,18 @@ def command(self) -> str: _tx_pps_key = "transmit-packets-per-second" _rx_pps_key = "receive-packets-per-second" + _tx_drop_key = "tx-packet-drops" + _rx_drop_key = "rx-packet-drops" + _tx_total_key = "tx-total-packets" + _rx_total_key = "rx-total-packets" _testpmd_output_regex = { _tx_pps_key: r"Tx-pps:\s+([0-9]+)", _rx_pps_key: r"Rx-pps:\s+([0-9]+)", + _tx_drop_key: r"TX-dropped:\s+([0-9]+)", + _rx_drop_key: r"RX-dropped:\s+([0-9]+)", + _tx_total_key: r"TX-packets:\s+([0-9]+)", + _rx_total_key: r"TX-packets:\s+([0-9]+)", } _source_build_dest_dir = "/usr/local/bin" @@ -716,6 +724,18 @@ def populate_performance_data(self) -> None: self.tx_pps_data = self.get_data_from_testpmd_output( self._tx_pps_key, self._last_run_output ) + self.tx_packet_drops = self.get_data_from_testpmd_output( + self._tx_drop_key, self._last_run_output + )[-1] + self.rx_packet_drops = self.get_data_from_testpmd_output( + self._rx_drop_key, self._last_run_output + )[-1] + self.tx_total_packets = self.get_data_from_testpmd_output( + self._tx_total_key, self._last_run_output + )[-1] + self.rx_total_packets = self.get_data_from_testpmd_output( + self._rx_total_key, self._last_run_output + )[-1] def get_mean_rx_pps(self) -> int: self._check_pps_data("RX") @@ -741,6 +761,26 @@ def get_min_tx_pps(self) -> int: self._check_pps_data("TX") return min(self.tx_pps_data) + def check_tx_packet_drops(self) -> None: + if self.tx_total_packets == 0: + raise AssertionError( + "Test bug: tx packet data was 0, could not check dropped packets" + ) + dropped_packet_percentage = self.tx_packet_drops / self.tx_total_packets + assert_that(dropped_packet_percentage).described_as( + "More than 20% of the tx packets were dropped!" + ).is_close_to(0, 0.2) + + def check_rx_packet_drops(self) -> None: + if self.rx_total_packets == 0: + raise AssertionError( + "Test bug: rx packet data was 0 could not check dropped packets." + ) + dropped_packet_percentage = self.rx_packet_drops / self.rx_total_packets + assert_that(dropped_packet_percentage).described_as( + "More than 1% of the received packets were dropped!" + ).is_close_to(0, 0.01) + def get_mean_tx_pps_sriov_hotplug(self) -> Tuple[int, int, int]: return self._get_pps_sriov_hotplug(self._tx_pps_key) diff --git a/lisa/microsoft/testsuites/dpdk/dpdkutil.py b/lisa/microsoft/testsuites/dpdk/dpdkutil.py index 0265991739..9d396d6dbe 100644 --- a/lisa/microsoft/testsuites/dpdk/dpdkutil.py +++ b/lisa/microsoft/testsuites/dpdk/dpdkutil.py @@ -672,6 +672,12 @@ def verify_dpdk_send_receive( "Throughput for SEND was below the correct order of magnitude" ).is_greater_than(2**20) + # verify sender didn't drop most of the packets + sender.testpmd.check_tx_packet_drops() + + # verify receiver didn't drop most of the packets + receiver.testpmd.check_rx_packet_drops() + return sender, receiver From 2cdffb6fff05a200c8889dede3863952141e89bf Mon Sep 17 00:00:00 2001 From: "Matthew McGovern (LINUX)" Date: Fri, 21 Nov 2025 12:58:50 -0800 Subject: [PATCH 2/2] annotate packet drops, adjust send ratio --- lisa/microsoft/testsuites/dpdk/dpdktestpmd.py | 14 +++++++------- lisa/microsoft/testsuites/dpdk/dpdkutil.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py b/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py index 3ef4e46c98..134a93d7ac 100644 --- a/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py +++ b/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py @@ -422,7 +422,7 @@ def command(self) -> str: _tx_drop_key: r"TX-dropped:\s+([0-9]+)", _rx_drop_key: r"RX-dropped:\s+([0-9]+)", _tx_total_key: r"TX-packets:\s+([0-9]+)", - _rx_total_key: r"TX-packets:\s+([0-9]+)", + _rx_total_key: r"RX-packets:\s+([0-9]+)", } _source_build_dest_dir = "/usr/local/bin" @@ -766,18 +766,18 @@ def check_tx_packet_drops(self) -> None: raise AssertionError( "Test bug: tx packet data was 0, could not check dropped packets" ) - dropped_packet_percentage = self.tx_packet_drops / self.tx_total_packets - assert_that(dropped_packet_percentage).described_as( - "More than 20% of the tx packets were dropped!" - ).is_close_to(0, 0.2) + self.dropped_packet_percentage = self.tx_packet_drops / self.tx_total_packets + assert_that(self.dropped_packet_percentage).described_as( + "More than 33% of the tx packets were dropped!" + ).is_close_to(0, 0.33) def check_rx_packet_drops(self) -> None: if self.rx_total_packets == 0: raise AssertionError( "Test bug: rx packet data was 0 could not check dropped packets." ) - dropped_packet_percentage = self.rx_packet_drops / self.rx_total_packets - assert_that(dropped_packet_percentage).described_as( + self.dropped_packet_percentage = self.rx_packet_drops / self.rx_total_packets + assert_that(self.dropped_packet_percentage).described_as( "More than 1% of the received packets were dropped!" ).is_close_to(0, 0.01) diff --git a/lisa/microsoft/testsuites/dpdk/dpdkutil.py b/lisa/microsoft/testsuites/dpdk/dpdkutil.py index 9d396d6dbe..9c508dfa83 100644 --- a/lisa/microsoft/testsuites/dpdk/dpdkutil.py +++ b/lisa/microsoft/testsuites/dpdk/dpdkutil.py @@ -678,9 +678,24 @@ def verify_dpdk_send_receive( # verify receiver didn't drop most of the packets receiver.testpmd.check_rx_packet_drops() + # annotate the amount of dropped packets on the receiver + annotate_packet_drops(log, result, receiver) + return sender, receiver +def annotate_packet_drops( + log: Logger, result: Optional[TestResult], receiver: DpdkTestResources +) -> None: + try: + if result and hasattr(receiver.testpmd, "dropped_packet_percentage"): + dropped_packets = receiver.testpmd.dropped_packet_percentage + result.information["rx_pkt_drop_percent"] = int(100 * dropped_packets) + log.debug(f"Adding packet drop percentage: {dropped_packets}") + except AssertionError as err: + receiver.node.log.debug(f"Could not add rx packet drop percentage: {str(err)}") + + def verify_dpdk_send_receive_multi_txrx_queue( environment: Environment, log: Logger,