Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions lisa/microsoft/testsuites/dpdk/dpdktestpmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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")
Expand All @@ -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.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."
)
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)

def get_mean_tx_pps_sriov_hotplug(self) -> Tuple[int, int, int]:
return self._get_pps_sriov_hotplug(self._tx_pps_key)

Expand Down
21 changes: 21 additions & 0 deletions lisa/microsoft/testsuites/dpdk/dpdkutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,30 @@ 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, "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,
Expand Down
Loading