Stanislav Fomichev wrote: > When we get packets on port 9091, we swap src/dst and send it out. > At this point, we also request the timestamp and plumb it back > to the userspace. The userspace simply prints the timestamp. > > Also print current UDP checksum, rewrite it with the pseudo-header > checksum and offload TX checksum calculation to devtx. Upon > completion, report TX checksum back (mlx5 doesn't put it back, so > I've used tcpdump to confirm that the checksum is correct). > > Some other related changes: > - switched to zerocopy mode by default; new flag can be used to force > old behavior > - request fixed TX_METADATA_LEN headroom > - some other small fixes (umem size, fill idx+i, etc) > > mvbz3:~# ./xdp_hw_metadata eth3 -c mlx5e_devtx_complete_xdp -s mlx5e_devtx_submit_xd > attach rx bpf program... > ... > 0x206d298: rx_desc[0]->addr=80100 addr=80100 comp_addr=80100 > rx_hash: 0x2BFB7FEC with RSS type:0x2A > rx_timestamp: 1690238278345877848 (sec:1690238278.3459) > XDP RX-time: 1690238278538397674 (sec:1690238278.5384) delta sec:0.1925 (192519.826 usec) > AF_XDP time: 1690238278538515250 (sec:1690238278.5385) delta sec:0.0001 (117.576 usec) > 0x206d298: ping-pong with csum=8e3b (want 57c9) csum_start=54 csum_offset=6 > 0x206d298: complete tx idx=0 addr=10 > 0x206d298: tx_timestamp: 1690238278577008140 (sec:1690238278.5770) > 0x206d298: complete rx idx=128 addr=80100 > > mvbz4:~# nc -Nu -q1 ${MVBZ3_LINK_LOCAL_IP}%eth3 9091 > > mvbz4:~# tcpdump -vvx -i eth3 udp > tcpdump: listening on eth3, link-type EN10MB (Ethernet), snapshot length 262144 bytes > 10:12:43.901436 IP6 (flowlabel 0x7a5d2, hlim 127, next-header UDP (17) payload length: 11) fe80::1270:fdff:fe48:1087.44339 > fe80::1270:fdff:fe48:1077.9091: [bad udp cksum 0x3b8e -> 0x0b4b!] UDP, length 3 > 0x0000: 6007 a5d2 000b 117f fe80 0000 0000 0000 > 0x0010: 1270 fdff fe48 1087 fe80 0000 0000 0000 > 0x0020: 1270 fdff fe48 1077 ad33 2383 000b 3b8e > 0x0030: 7864 70 > 10:12:43.902125 IP6 (flowlabel 0x7a5d2, hlim 127, next-header UDP (17) payload length: 11) fe80::1270:fdff:fe48:1077.9091 > fe80::1270:fdff:fe48:1087.44339: [udp sum ok] UDP, length 3 > 0x0000: 6007 a5d2 000b 117f fe80 0000 0000 0000 > 0x0010: 1270 fdff fe48 1077 fe80 0000 0000 0000 > 0x0020: 1270 fdff fe48 1087 2383 ad33 000b 0b4b > 0x0030: 7864 70 > > Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx> > --- > tools/testing/selftests/bpf/xdp_hw_metadata.c | 201 +++++++++++++++++- > 1 file changed, 191 insertions(+), 10 deletions(-) > > +static void usage(const char *prog) > +{ > + fprintf(stderr, > + "usage: %s [OPTS] <ifname>\n" > + "OPTS:\n" > + " -T don't generate AF_XDP reply (rx metadata only)\n" > + " -Z run in copy mode\n", nit: makes more sense to call copy mode 'C', rather than 'Z'