Sanity check VLAN offload on packet dropΒΆ

Check that VLAN offload is not broken by previous packet drop

PMDs tend to maintain offload state in software for various reasons, and in the case of VLAN offload there is a possible pitfall when a packet is dropped due to lack of room for descriptors: if this packet enables VLAN offload, the PMD must make sure that its software state for that offload is rolled back, otherwise the next packet with exactly the same VLAN TCI will make the PMD assume that the HW is already set for this offload and nothing has to be changed. In the latter case, the offload will be wrong.

The test tries to reproduce this corner case by sending two packets with identical VLAN IDs, the first one being wittingly sliced into more mbufs than the number of descriptors in Tx ring and thus going to be dismissed.

  1. Prepare TEST_ETHDEV_INITIALIZED state.

  2. Obtain the source Ethernet address.

  3. Fill in offloads needed by the test regardless whether these capabilities are supported by the current RTE release or not. Preserve automatically added device offloads.

  4. Sort out the set of capabilities to use valid Tx mode configuration.

  5. Prepare TEST_ETHDEV_RX_SETUP_DONE state.

  6. Choose a reasonable number of Tx queue descriptors and set sufficient payload length for the first packet so that it can be sliced into as many segments as how many descriptors the queue has, plus one.

  7. Adjust the traffic template and make its copy.

  8. Setup the only Tx queue.

  9. Randomly select VLAN ID.

  10. Describe 'send transformations' so that it is possible to generate traffic pattern aware of VLAN offload on the next step.

  11. Prepare the first packet mbuf.

  12. Query header length fields of the packet; this result will stay valid for the second packet, too.

  13. Derive Ethernet payload length of the packet; this result will stay valid for the second packet, too.

  14. Fix MTU on both ends if required.

  15. Prepare TEST_ETHDEV_STARTED state.

  16. Slice the first packet mbuf into as many segments as how many descriptors the transmit queue has, plus one, so that the packet is going to be rejected.

  17. Try to send the first packet and make sure it gets dismissed. Don't validate the packet since Tx prepare API will reject it too early without any chance to face Tx burst API and check VLAN TCI rollback behaviour

  18. Prepare the second packet mbuf.

  19. Create an Rx CSAP on TST host according to the template.

  20. Start capturing traffic with the pattern prepared.

  21. Ensure that interface is UP on Tester side

  22. Validate and send the second packet and make sure it does not get dismissed.

  23. Stop capturing traffic.

  24. Verify the number of matching packets received.

Parameters:

tmpl

Traffic template