From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by mail.toke.dk (Postfix) with ESMTPS id 0A045A163AD for ; Wed, 5 Jul 2023 19:41:53 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=uzeZEtL5 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5766e49b802so70324857b3.1 for ; Wed, 05 Jul 2023 10:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688578912; x=1691170912; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZysTQEzsXNfv9/zc6i6AMHbJRPjccBtGTVYt/z+7iG8=; b=uzeZEtL533ctpHnx6mqkgSmvRqdcyz/y9qdWulRy6xihOQGLoEfkMePrkf5iXRlzo0 uyNWaQwzqVytE5wtFiu0+6I+aCdwaGgQU6xFR/+2udx7QtU6QywGf+zLJcJtQo4bgcCk /5YzSlfNx8S+p+hi1EeD1ex9RotAJudkOTYXivUvhXoFPRGS+QimXd0VBXkI8yTYP6zk wE027LPgVIEe2BPMzV8QYwydqoRcyrk4ax0xMS92k/Ctftcg6SJv7t3vU1PWe7yXWs4g aTYfMIefw3s1kckVlvLXZtWCB2JugtRLVVo+7DEhOwbRvRx26z6ElLtMgRr5Iim+aa0T F6Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688578912; x=1691170912; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZysTQEzsXNfv9/zc6i6AMHbJRPjccBtGTVYt/z+7iG8=; b=Wf8V5dVlxKPm/1ahn9HRsvoUuMqSb/gBdBOdirVQDUmAH9M4ILURICzn5M8N+XBKG+ PLHvXJ3wrvqtQWQnUoSIi2iWq8TwzuhxBFbMf2nt+HyToIAALTrCLUJVYR9IzGZ2CTAR 6SuQ/mc27fsuDC1AjCkx7fGOWblAfUvagRGGXPUF0EpxF4qHRv6TV9Kcdt2bWfb2vKjH 48Iootl2aVCBIMnoFDs+665tryyhEbZts6+hMvsnvqr/mq0lvmpT+sECfwP8Zk4vne6Z NfSGVnRhVGRmKCLPv6yNYUv0l2pGJn/gOdTYHS49YPooYxQVHk3a9dIKaF2riNPW8tP/ rgdg== X-Gm-Message-State: ABy/qLboQW91QNqIoTYV+kdfJJbGF2YUtfVmEepfXxw3XNB9YXScIB6p HfSzxcHVf3E+u718h1OGG5tnL9M= X-Google-Smtp-Source: APBJJlErCsnDy8jvP1Va18YPs7fh1ocFLM3/DnwGzVxPoHzApFhvOsuc+5wTbgY0ayky1lip5wKeonI= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a81:8412:0:b0:577:3712:125d with SMTP id u18-20020a818412000000b005773712125dmr117514ywf.4.1688578911887; Wed, 05 Jul 2023 10:41:51 -0700 (PDT) Date: Wed, 5 Jul 2023 10:41:50 -0700 In-Reply-To: <20230703181226.19380-21-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230703181226.19380-1-larysa.zaremba@intel.com> <20230703181226.19380-21-larysa.zaremba@intel.com> Message-ID: From: Stanislav Fomichev To: Larysa Zaremba Content-Type: text/plain; charset="utf-8" Message-ID-Hash: ZDF56IIYURZ7B3LTUSYEBE6SX2W6GCKA X-Message-ID-Hash: ZDF56IIYURZ7B3LTUSYEBE6SX2W6GCKA X-MailFrom: 3X6ulZAMKCXgoZbckkcha.YkitZl-dejpotZl-lnkfaYp.jap@flex--sdf.bounces.google.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: bpf@vger.kernel.org, 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, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 20/20] selftests/bpf: check checksum level in xdp_metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 07/03, Larysa Zaremba wrote: > Verify, whether kfunc in xdp_metadata test correctly returns checksum level > of zero. > > Signed-off-by: Larysa Zaremba Acked-by: Stanislav Fomichev > --- > tools/testing/selftests/bpf/prog_tests/xdp_metadata.c | 3 +++ > tools/testing/selftests/bpf/progs/xdp_metadata.c | 7 +++++++ > 2 files changed, 10 insertions(+) > > diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > index 50ac9f570bc5..6c71d712932e 100644 > --- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > +++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > @@ -228,6 +228,9 @@ static int verify_xsk_metadata(struct xsk *xsk) > if (!ASSERT_EQ(meta->rx_vlan_proto, VLAN_PID, "rx_vlan_proto")) > return -1; > > + if (!ASSERT_NEQ(meta->rx_csum_lvl, 0, "rx_csum_lvl")) > + return -1; > + > xsk_ring_cons__release(&xsk->rx, 1); > refill_rx(xsk, comp_addr); > > diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c b/tools/testing/selftests/bpf/progs/xdp_metadata.c > index 382984a5d1c9..6f7223d581b7 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c > @@ -26,6 +26,8 @@ extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash, > extern int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx, > __u16 *vlan_tag, > __be16 *vlan_proto) __ksym; > +extern int bpf_xdp_metadata_rx_csum_lvl(const struct xdp_md *ctx, > + __u8 *csum_level) __ksym; > > SEC("xdp") > int rx(struct xdp_md *ctx) > @@ -62,6 +64,11 @@ int rx(struct xdp_md *ctx) > bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta->rx_hash_type); > bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_tag, &meta->rx_vlan_proto); > > + /* Same as with timestamp, zero is expected */ > + ret = bpf_xdp_metadata_rx_csum_lvl(ctx, &meta->rx_csum_lvl); > + if (!ret && meta->rx_csum_lvl == 0) > + meta->rx_csum_lvl = 1; > + > return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS); > } > > -- > 2.41.0 >