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