>
>
> +
> +class Config(BaseConfig):
> + """Performance test metrics."""
> +
> + test_parameters: list[dict[str, int | float]] = [
> + {"frame_size": 64, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + {"frame_size": 128, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + {"frame_size": 256, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + {"frame_size": 512, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + {"frame_size": 1024, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + {"frame_size": 1518, "num_descriptors": 1024, "expected_mpps":
> 1.00},
> + ]
> + delta_tolerance: float = 0.05
> +
This test suite needs an example in tests_config.example.yaml for
configuration.
Also, Test suites that are new to next-dts need an accompanying doc file in
doc/api/dts.
>
+
> +@requires_link_topology(LinkTopology.TWO_LINKS)
> +class TestPvpMultiPathsVhostSingleCorePerformance(TestSuite):
> + """pvp multi paths vhost single core performance test suite."""
> +
> + config: Config
> +
> + def set_up_suite(self):
> + """Assign test parameters."""
> + self.test_parameters = self.config.test_parameters
> + self.delta_tolerance = self.config.delta_tolerance
>
nit: Missing (-> None) in method signature
> +
> + def set_up_test_case(self):
> + """Delete stale vhost-user Unix domain socket files."""
> + self._ctx.sut_node.main_session.send_command("rm -rf
> /tmp/vhost-net*", privileged=True)
> +
>
nit: Missing (-> None) in signature
> + def _transmit(
> + self, vhost: TestPmd, virtio: TestPmd, frame_size: int,
> repetitions: int = 1
> + ) -> float:
> + """Transmit packets using testpmd instances and compute average
> MPPS.
> +
> + Args:
> + vhost: the running vhost testpmd shell.
> + virtio: the running virtio testpmd shell.
> + frame_size: The size of the frame to transmit.
> + repetitions: The number of times to rerun the transmission.
> +
> + Returns:
> + The MPPS (millions of packets per second) forwarded by the
> SUT.
> + """
> + assert repetitions > 0, "Invalid number of repetitions given."
>
nit: Error message should include why this number of repetitions are invalid
> + def _create_and_transmit(
> + self,
> + ring_format: int,
> + in_order: int,
> + buffers: int,
> + vectorized: int,
> + extra_args: TestPmdParamsDict,
> + ) -> None:
> + """Create testpmd instances with specified params and send
> traffic."""
>
Missing "Args:" tag
> + with (
> + TestPmd(**vhost_params) as vhost,
> + TestPmd(**virtio_params) as virtio,
> + ):
> + vhost.set_forward_mode(SimpleForwardingModes.mac)
> + virtio.set_forward_mode(SimpleForwardingModes.io)
> + vhost.set_portlist([0, 2, 1])
> +
> + params["measured_mpps"] = round(
> + self._transmit(vhost, virtio, frame_size,
> repetitions=5), 3
> + )
> + params["performance_delta"] = round(
> + (float(params["measured_mpps"]) -
> float(params["expected_mpps"]))
> + / float(params["expected_mpps"]),
> + 3,
> + )
+ params["pass"] = float(params["performance_delta"]) >=
> -self.delta_tolerance
This allows for a division by zero exception if the user supplies an
expected mpps of zero.
Other than these small things, the patch looks good.
Reviewed-by: Andrew Bailey <[email protected]>