Check sending and receiving with AF_XDP sockets

Check that AF_XDP sockets can receive and send packets.

  1. Create UDP socket on Tester, bind it to tst_addr.

  2. Make sure that RSS indirection table mentions all the available Rx queues on IUT.

  3. From IUT TA pin XSK BPF map of rxq_stats XDP program to a file. From IUT RPC server open that file to obtain file descriptor of the map.

  4. Create AF_XDP sockets on IUT, one per each Rx queue. Set XDP copy mode according to copy_mode when binding the sockets. Set corresponding entries of the XSK map to file desciptors of the created sockets.

  5. Configure rxq_stats program on IUT to process only packets going from tst_addr to iut_addr (accepting any destination port).

  6. For every Rx queue on IUT:

    • Find the destination IUT port such that with that port packets sent from tst_addr will be directed to the tested Rx queue.

    • Send a packet from the Tester socket. Check that the AF_XDP socket assigned to the tested Rx queue gets that packet. Construct a reply by inverting addresses and ports of the received packet. Send it back to Tester over the same AF_XDP socket. Check that the Tester socket gets it and its payload is the same as in the previously sent packet.

Parameters:

env

Testing environment:

copy_mode

XDP copy mode:

  • none (kernel tries zero-copy, falls back to copy mode if it fails)

  • copy

  • zerocopy