From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by mail.toke.dk (Postfix) with ESMTPS id 25245A1C0BA for ; Tue, 25 Jul 2023 22:59:16 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=XhUI8s5o Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-768197bad1cso619038285a.1 for ; Tue, 25 Jul 2023 13:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690318755; x=1690923555; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zQT4CWtf4mJ5fxuXEahsMEsrtApDWNKjhlbuKuN2pcI=; b=XhUI8s5ouoFGkany53TNKsgiLvRcHy4FtD3K/zDNI8H6mkRFx3wMlE9fMvKXAZOuc5 zLBqk8gPXt24QfKVeuK5Dg77aBbJTweywoz3SW84vmNOoC7FLiK3PS+un2CC4IeGG8F4 DouGHxMA1M+05ifHzhO8YN13X3eZGKM/woA1mVpN58tiDVZOy1UYNtLmiPHtPLFxxbq3 yIds2VjzPYyFLnAjqDa9jyYPicMl6aekdSk9Y64mfjfhPUs6lYAqySMlO03TI0odwaJW usSoGrm0zi734f27cLy7pweMdOYbU6AZoXwAJZa6ZG3LePWZr/R1hk8cnuw512gQliTz PYrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690318755; x=1690923555; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zQT4CWtf4mJ5fxuXEahsMEsrtApDWNKjhlbuKuN2pcI=; b=fyEOLG5vGuKYGocIftk/b2TDxjvjk5zyEKu4DVhrs1k0AXX07iG9cdJKJk9uezU3hY KdbEUN7H4/n8gZu1Q+5J5bYRUiSxwjSV5a/4reAlXr8jC6BxhOD/vDD5JYQSr4JelAfn UUDr4hdtdamcPJlD/KWDLuF7y2KRxLX8nIx87hV0wa5Yy1xxuVv2GCZNCN9O6m8UwC0A YVth08763DnzVx1FRm5z2B3y58fZye1FGh8fgT416zNaHXtron+rz/iRcWtgkSww6Zc6 ufB0QkVp/YArdOfTDqgnWqvjtwem25dJFAl6mxeUOeWeR/SgRyGt3rYJc5kKrGk2yv3Y bBuA== X-Gm-Message-State: ABy/qLYuSHv3q/3x+gh7t+ds+lWb+cW0MTJtaNI8WpOGXV0J1QhaifXA WlKaVVoi5ls/H7InriujEqg= X-Google-Smtp-Source: APBJJlEjKu1cbNJyzjxBvmhqKT/0B7iVOucrA0PspBWTREMkkSmaoA7a6/C5w7qDocAHGdzp5uJoDA== X-Received: by 2002:a05:620a:2a01:b0:76c:4d4c:7942 with SMTP id o1-20020a05620a2a0100b0076c4d4c7942mr129512qkp.21.1690318755303; Tue, 25 Jul 2023 13:59:15 -0700 (PDT) Received: from localhost (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id g26-20020a37e21a000000b00767e62bcf0csm3914389qki.65.2023.07.25.13.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 13:59:15 -0700 (PDT) Date: Tue, 25 Jul 2023 16:59:14 -0400 From: Willem de Bruijn To: Stanislav Fomichev , bpf@vger.kernel.org Message-ID: <64c037a2cab54_3fe1bc29433@willemb.c.googlers.com.notmuch> In-Reply-To: <20230724235957.1953861-9-sdf@google.com> References: <20230724235957.1953861-1-sdf@google.com> <20230724235957.1953861-9-sdf@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Message-ID-Hash: B7MAABXMA4Y34LOOTNXLFF4IUU7LSAVO X-Message-ID-Hash: B7MAABXMA4Y34LOOTNXLFF4IUU7LSAVO X-MailFrom: willemdebruijn.kernel@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, kuba@kernel.org, toke@kernel.org, willemb@google.com, dsahern@kernel.org, magnus.karlsson@intel.com, bjorn@kernel.org, maciej.fijalkowski@intel.com, hawk@kernel.org, netdev@vger.kernel.org, xdp-hints@xdp-project.net X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [RFC net-next v4 8/8] selftests/bpf: Add TX side to xdp_hw_metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 > --- > 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] \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'