On Fri, Jan 17, 2025 at 9:58 AM Nicholas Pratte <npratte@iol.unh.edu> wrote:

+    def assess_mtu_boundary(self, testpmd_shell: TestPmdShell, mtu: int) -> None:
+        """Sets the new MTU and verifies packets at the set boundary.
+
+        Ensure that packets smaller than or equal to a set MTU will be received and packets larger
+        will not.
+
+        First, start testpmd and update the MTU. Then ensure the new value appears
+        on port info for all ports.
+        Next, start packet capturing and send 3 different lengths of packet and verify
+        they are handled correctly.
+            # 1. VENDOR_AGNOSTIC_PADDING units smaller than the MTU specified.
+            # 2. Equal to the MTU specified.
+            # 3. VENDOR_AGNOSTIC_PADDING units larger than the MTU specified (should be fragmented).
+        Finally, stop packet capturing.
+
+        Args:
+            testpmd_shell: Active testpmd shell of a given test case.
+            mtu: New Maximum Transmission Unit to be tested.
+        """
+        # Send 3 packets of different sizes (accounting for vendor inconsistencies).
+        # 1. VENDOR_AGNOSTIC_PADDING units smaller than the MTU specified.
+        # 2. Equal to the MTU specified.
+        # 3. VENDOR_AGNOSTIC_PADDING units larger than the MTU specified.
+        smaller_frame_size: int = mtu - VENDOR_AGNOSTIC_PADDING
+        equal_frame_size: int = mtu
+        larger_frame_size: int = mtu + VENDOR_AGNOSTIC_PADDING
+
+        self.send_packet_and_verify(pkt_size=smaller_frame_size, should_receive=True)
+        self.send_packet_and_verify(pkt_size=equal_frame_size, should_receive=True)
+
+        current_mtu = testpmd_shell.show_port_info(0).mtu
+        self.verify(current_mtu is not None, "Error grabbing testpmd MTU value.")
+        if current_mtu and (
+            current_mtu >= STANDARD_MTU + VENDOR_AGNOSTIC_PADDING and mtu == STANDARD_MTU
+        ):
+            self.send_packet_and_verify(pkt_size=larger_frame_size, should_receive=True)

I don't understand when this condition may be true - can you explain? Thanks!
 
+        else:
+            self.send_packet_and_verify(pkt_size=larger_frame_size, should_receive=False)
+
+    @func_test
+    def test_runtime_mtu_updating_and_forwarding(self) -> None:
+        """Verify runtime MTU adjustments and assess packet forwarding behavior.
+
+        Test:
+            Start TestPMD in a paired topology.
+            Set port MTU to 1500.
+            Send packets of 1493, 1500 and 1509 bytes.

I think 1493 should be 1491.
 
--
2.47.1


Thanks, other than a couple questions here and in the associated patch this looks good. I can merge on Tuesday. 

Reviewed-by: Patrick Robb <probb@iol.unh.edu>
Tested-by: Patrick Robb <probb@iol.unh.edu>