diff --git a/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py b/lisa/microsoft/testsuites/dpdk/dpdktestpmd.py index 8febbbb443..0bf83f991a 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"RX-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" + ) + self.packet_drop_rate = self.tx_packet_drops / self.tx_total_packets + assert_that(self.packet_drop_rate).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." + ) + self.packet_drop_rate = self.rx_packet_drops / self.rx_total_packets + assert_that(self.packet_drop_rate).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..0e7c9f307a 100644 --- a/lisa/microsoft/testsuites/dpdk/dpdkutil.py +++ b/lisa/microsoft/testsuites/dpdk/dpdkutil.py @@ -672,9 +672,31 @@ 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() + + # 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, "packet_drop_rate"): + dropped_packets = receiver.testpmd.packet_drop_rate + fmt_drop_rate = f"{dropped_packets:.2f}" + result.information["rx_pkt_drop_rate"] = fmt_drop_rate + log.debug(f"Adding packet drop percentage: {fmt_drop_rate}") + 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,