mtu Test Suite
MTU update and jumbo frame forwarding test suite.
A suite of tests to ensures the consistency of jumbo and standard frame transmission within a DPDK application. If a NIC receives a packet that is greater than its assigned MTU length, then that packet should be dropped. Likewise, if a NIC receives a packet that is less than or equal to a designated MTU length, the packet should be accepted.
The definition of MTU between individual vendors varies with a +/- difference of 9 bytes, at most. To universally test MTU functionality, and not concern over individual vendor behavior, this test suite compensates using a 9 byte upper and lower bound when testing a set MTU boundary.
- class TestMtu
Bases:
TestSuite
DPDK PMD jumbo frames and MTU update test suite.
Assess the expected behavior of frames greater than, less then, or equal to a designated MTU size in a DPDK application.
Verify the behavior of both runtime MTU and pre-runtime MTU adjustments within DPDK applications. (TestPMD’s CLI and runtime MTU adjustment options leverage different logical in components within ethdev to set a value).
Test cases will verify that any frame greater than an assigned MTU are dropped and packets less than or equal to a designated MTU are forwarded and fully intact.
- set_up_suite() None
Set up the test suite.
- Setup:
Set traffic generator MTU lengths to a size greater than scope of all test cases.
- send_packet_and_verify(pkt_size: int, should_receive: bool) None
Generate, send a packet, and assess its behavior based on a given packet size.
Generates a packet based on a specified size and sends it to the SUT. The desired packet’s payload size is calculated, and a string of arbrity size, containing a single character, is placed in the packet as payload. This method assesses whether or not it was forwarded, depending on the test case, and does so via a check of the previously-inserted packet payload.
- Parameters:
pkt_size (int) – Size of packet to be generated and sent.
should_receive (bool) – Indicate whether the test case expects to receive the packet or not.
- assess_mtu_boundary(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:
VENDOR_AGNOSTIC_PADDING units smaller than the MTU specified.
Equal to the MTU specified.
VENDOR_AGNOSTIC_PADDING units larger than the MTU specified (should be fragmented).
Finally, stop packet capturing.
- Parameters:
testpmd_shell (TestPmdShell) – Active testpmd shell of a given test case.
mtu (int) – New Maximum Transmission Unit to be tested.
- test_runtime_mtu_updating_and_forwarding() 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 1491, 1500 and 1509 bytes.
Verify the first two packets are forwarded and the last is dropped.
Set port MTU to 2400.
- Send packets of 1491, 1500 and 1509 bytes.
Verify all three packets are forwarded.
- Send packets of 2391, 2400 and 2409 bytes.
Verify the first two packets are forwarded and the last is dropped.
Set port MTU to 4800.
- Send packets of 1491, 1500 and 1509 bytes.
Verify all three packets are forwarded.
- Send packets of 4791, 4800 and 4809 bytes.
Verify the first two packets are forwarded and the last is dropped.
Set port MTU to 9000.
- Send packets of 1491, 1500 and 1509 bytes.
Verify all three packets are forwarded.
- Send packets of 8991, 9000 and 9009 bytes.
Verify the first two packets are forwarded and the last is dropped.
- Verify:
Verifies the successful forwarding of packets via a search for an inserted payload. If the payload is found, the packet was transmitted successfully. Otherwise, the packet is considered dropped.
Verify that standard MTU packets forward, in addition to packets within the limits of an MTU size set during runtime.
- test_cli_mtu_forwarding_for_std_packets() None
Assesses packet forwarding of standard MTU packets after pre-runtime MTU adjustments.
- Test:
Start TestPMD with MTU size of 1518 bytes, set pre-runtime.
Send packets of size 1491, 1500 and 1509 bytes.
Verify the first two packets are forwarded and the last is dropped.
- Verify:
Verifies the successful forwarding of packets via a search for an inserted payload. If the payload is found, the packet was transmitted successfully. Otherwise, the packet is considered dropped.
Verify the first two packets are forwarded and the last is dropped after pre-runtime MTU modification.
- test_cli_jumbo_forwarding_for_jumbo_mtu() None
Assess packet forwarding of packets within the bounds of a pre-runtime MTU adjustment.
- Test:
Start TestPMD with MTU size of 9018 bytes, set pre-runtime.
Send packets of size 8991, 9000 and 1509 bytes.
- Verify:
Verifies the successful forwarding of packets via a search for an inserted payload. If the payload is found, the packet was transmitted successfully. Otherwise, the packet is considered dropped.
Verify that all packets are forwarded after pre-runtime MTU modification.
- test_cli_mtu_std_packets_for_jumbo_mtu() None
Assess boundary of jumbo MTU value set pre-runtime.
- Test:
Start TestPMD with MTU size of 9018 bytes, set pre-runtime.
Send a packets of size 8991, 9000 and 9009 bytes.
Verify the first two packets are forwarded and the last is dropped.
- Verify:
Verifies the successful forwarding of packets via a search for an inserted payload. If the payload is found, the packet was transmitted successfully. Otherwise, the packet is considered dropped.
Verify the first two packets are forwarded and the last is dropped after pre-runtime MTU modification.
- tear_down_suite() None
Tear down the test suite.
- Teardown:
Set the MTU size of the traffic generator back to the standard 1518 byte size.