Skip to content

Commit 9267eff

Browse files
committed
dpdk: testpmd check packet drops
1 parent 4f18505 commit 9267eff

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

lisa/microsoft/testsuites/dpdk/dpdktestpmd.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,18 @@ def command(self) -> str:
411411

412412
_tx_pps_key = "transmit-packets-per-second"
413413
_rx_pps_key = "receive-packets-per-second"
414+
_tx_drop_key = "tx-packet-drops"
415+
_rx_drop_key = "rx-packet-drops"
416+
_tx_total_key = "tx-total-packets"
417+
_rx_total_key = "rx-total-packets"
414418

415419
_testpmd_output_regex = {
416420
_tx_pps_key: r"Tx-pps:\s+([0-9]+)",
417421
_rx_pps_key: r"Rx-pps:\s+([0-9]+)",
422+
_tx_drop_key: r"TX-dropped:\s+([0-9]+)",
423+
_rx_drop_key: r"RX-dropped:\s+([0-9]+)",
424+
_tx_total_key: r"TX-packets:\s+([0-9]+)",
425+
_rx_total_key: r"TX-packets:\s+([0-9]+)",
418426
}
419427
_source_build_dest_dir = "/usr/local/bin"
420428

@@ -716,6 +724,18 @@ def populate_performance_data(self) -> None:
716724
self.tx_pps_data = self.get_data_from_testpmd_output(
717725
self._tx_pps_key, self._last_run_output
718726
)
727+
self.tx_packet_drops = self.get_data_from_testpmd_output(
728+
self._tx_drop_key, self._last_run_output
729+
)[-1]
730+
self.rx_packet_drops = self.get_data_from_testpmd_output(
731+
self._rx_drop_key, self._last_run_output
732+
)[-1]
733+
self.tx_total_packets = self.get_data_from_testpmd_output(
734+
self._tx_total_key, self._last_run_output
735+
)[-1]
736+
self.rx_total_packets = self.get_data_from_testpmd_output(
737+
self._rx_total_key, self._last_run_output
738+
)[-1]
719739

720740
def get_mean_rx_pps(self) -> int:
721741
self._check_pps_data("RX")
@@ -741,6 +761,26 @@ def get_min_tx_pps(self) -> int:
741761
self._check_pps_data("TX")
742762
return min(self.tx_pps_data)
743763

764+
def check_tx_packet_drops(self) -> None:
765+
if self.tx_total_packets == 0:
766+
raise AssertionError(
767+
"Test bug: tx packet data was 0, could not check dropped packets"
768+
)
769+
dropped_packet_percentage = self.tx_packet_drops / self.tx_total_packets
770+
assert_that(dropped_packet_percentage).described_as(
771+
"Most of the tx packets were dropped!"
772+
).is_not_close_to(1, 0.2)
773+
774+
def check_rx_packet_drops(self) -> None:
775+
if self.rx_total_packets == 0:
776+
raise AssertionError(
777+
"Possible test bug: rx packet data was 0, could not check dropped packets."
778+
)
779+
dropped_packet_percentage = self.rx_packet_drops / self.rx_total_packets
780+
assert_that(dropped_packet_percentage).described_as(
781+
"Most of the rx packets were dropped!"
782+
).is_not_close_to(1, 0.2)
783+
744784
def get_mean_tx_pps_sriov_hotplug(self) -> Tuple[int, int, int]:
745785
return self._get_pps_sriov_hotplug(self._tx_pps_key)
746786

lisa/microsoft/testsuites/dpdk/dpdkutil.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,12 @@ def verify_dpdk_send_receive(
672672
"Throughput for SEND was below the correct order of magnitude"
673673
).is_greater_than(2**20)
674674

675+
# verify sender didn't drop most of the packets
676+
sender.testpmd.check_tx_packet_drops()
677+
678+
# verify receiver didn't drop most of the packets
679+
receiver.testpmd.check_rx_packet_drops()
680+
675681
return sender, receiver
676682

677683

0 commit comments

Comments
 (0)