<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2025 at 9:58 AM Nicholas Pratte <<a href="mailto:npratte@iol.unh.edu">npratte@iol.unh.edu</a>> wrote:<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 assess_mtu_boundary(self, testpmd_shell: TestPmdShell, mtu: int) -> None:<br>
+        """Sets the new MTU and verifies packets at the set boundary.<br>
+<br>
+        Ensure that packets smaller than or equal to a set MTU will be received and packets larger<br>
+        will not.<br>
+<br>
+        First, start testpmd and update the MTU. Then ensure the new value appears<br>
+        on port info for all ports.<br>
+        Next, start packet capturing and send 3 different lengths of packet and verify<br>
+        they are handled correctly.<br>
+            # 1. VENDOR_AGNOSTIC_PADDING units smaller than the MTU specified.<br>
+            # 2. Equal to the MTU specified.<br>
+            # 3. VENDOR_AGNOSTIC_PADDING units larger than the MTU specified (should be fragmented).<br>
+        Finally, stop packet capturing.<br>
+<br>
+        Args:<br>
+            testpmd_shell: Active testpmd shell of a given test case.<br>
+            mtu: New Maximum Transmission Unit to be tested.<br>
+        """<br>
+        # Send 3 packets of different sizes (accounting for vendor inconsistencies).<br>
+        # 1. VENDOR_AGNOSTIC_PADDING units smaller than the MTU specified.<br>
+        # 2. Equal to the MTU specified.<br>
+        # 3. VENDOR_AGNOSTIC_PADDING units larger than the MTU specified.<br>
+        smaller_frame_size: int = mtu - VENDOR_AGNOSTIC_PADDING<br>
+        equal_frame_size: int = mtu<br>
+        larger_frame_size: int = mtu + VENDOR_AGNOSTIC_PADDING<br>
+<br>
+        self.send_packet_and_verify(pkt_size=smaller_frame_size, should_receive=True)<br>
+        self.send_packet_and_verify(pkt_size=equal_frame_size, should_receive=True)<br>
+<br>
+        current_mtu = testpmd_shell.show_port_info(0).mtu<br>
+        self.verify(current_mtu is not None, "Error grabbing testpmd MTU value.")<br>
+        if current_mtu and (<br>
+            current_mtu >= STANDARD_MTU + VENDOR_AGNOSTIC_PADDING and mtu == STANDARD_MTU<br>
+        ):<br>
+            self.send_packet_and_verify(pkt_size=larger_frame_size, should_receive=True)<br></blockquote><div><br></div><div>I don't understand when this condition may be true - can you explain? Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+        else:<br>
+            self.send_packet_and_verify(pkt_size=larger_frame_size, should_receive=False)<br>
+<br>
+    @func_test<br>
+    def test_runtime_mtu_updating_and_forwarding(self) -> None:<br>
+        """Verify runtime MTU adjustments and assess packet forwarding behavior.<br>
+<br>
+        Test:<br>
+            Start TestPMD in a paired topology.<br>
+            Set port MTU to 1500.<br>
+            Send packets of 1493, 1500 and 1509 bytes.<br></blockquote><div><br></div><div>I think 1493 should be 1491.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-- <br>
2.47.1<br>
<br></blockquote><div><br></div><div>Thanks, other than a couple questions here and in the associated patch this looks good. I can merge on Tuesday. </div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div><div>Tested-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div></div></div>