From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by mail.toke.dk (Postfix) with ESMTPS id 7848E9FCFE4 for ; Wed, 12 Apr 2023 00:42:27 +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=uKwy/ail Received: by mail-pj1-x102e.google.com with SMTP id mn5-20020a17090b188500b00246eddf34f6so1848864pjb.0 for ; Tue, 11 Apr 2023 15:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681252945; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=E0xO9Bx9i5tldfd7adzq3NuOgykDM+T3WB8seKN/9fM=; b=uKwy/ailVcOdYbsnJvdxytCFTrv0n9YS+0ARjJFB00iUjwbkqRfGDfF4iYzZ1iG9Kv 82FGZ/RpThSY7QFxdhSjPl4N6pfaAYAQMd9Ex1gbWk6CB/OpsWHbkyHE5HbkBtCln6AE CCetfIcGqIF201lBE0Y2PEFqvyxG/rYdrihtSshNnCdmy+JT1Jp8YKvBWU+bzR94zy3Y gb0f4CVOuc7NI5ZIKEg3JU+1EpjqKZ28E3JxVlDdNU6OSXDzHwfO/rXmhyT3vdqjpb9S lWZdb+Ngq9YKJhhVvmPUq+K8pUbhytxE29NwfYYWpcUSUjgY+3DZpEWJQCeBrv1S5tuK 3KDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681252945; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E0xO9Bx9i5tldfd7adzq3NuOgykDM+T3WB8seKN/9fM=; b=Zm+844DgtPmJ1nC5ZNoGv4PdxVPDDBHdKff6S05BYqTHO8gXLQpqL+OKRsPZvjYhKV kKd5w5EKGzkGIrYE2fLv/dUOECPA5q/ltpnyLN8ewP+l37jKaTm5JdSAA9ljtBA0Gacx TAaIGJhpDnaxjoQG+VT5BQx1kPmDx8QyHA2yq2VjKAPmCYO3g49dk05784oeTULxgJDe xftmwzIhd+XGx3xadrq57G5im+v/+AUI+hqpE9U8ebJQG5QQhKbr/bjtJ/P7GGmbr0HS TSRLVEzD0tS2yPwH8zGBwRqYQVfO7wrW6mdZtqlmVGjJRlUVG2y3Usfp5Y1ZJlw6FLrO SbxA== X-Gm-Message-State: AAQBX9e+zTz1N7kY2WeHIPvDukDHDRhM3Di9Gmxs8JiyMLb6ia51Qvjb MZQC0grky6pXIlCGHrVwq6WmzHtfhSmDVqRK+z/pIg== X-Google-Smtp-Source: AKy350Yke3xHvPIcVDrfJDNbsXAC8S4tRog/pB48r6EGnMKgP8FWKKWc/STPyg9eHg7eVsBk44WhbqLGoyLPXsVzwRk= X-Received: by 2002:a17:90a:6bc3:b0:23b:36cc:f347 with SMTP id w61-20020a17090a6bc300b0023b36ccf347mr3906797pjj.9.1681252945157; Tue, 11 Apr 2023 15:42:25 -0700 (PDT) MIME-Version: 1.0 References: <168098183268.96582.7852359418481981062.stgit@firesoul> <168098188134.96582.7870014252568928901.stgit@firesoul> In-Reply-To: <168098188134.96582.7870014252568928901.stgit@firesoul> From: Stanislav Fomichev Date: Tue, 11 Apr 2023 15:42:13 -0700 Message-ID: To: Jesper Dangaard Brouer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Q7O7BFW7BTXSRIFAQTYJLMTVDRXZ5ZW2 X-Message-ID-Hash: Q7O7BFW7BTXSRIFAQTYJLMTVDRXZ5ZW2 X-MailFrom: sdf@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, =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net, tariqt@nvidia.com, saeedm@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf V7 1/7] selftests/bpf: xdp_hw_metadata default disable bpf_printk List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Sat, Apr 8, 2023 at 12:24=E2=80=AFPM Jesper Dangaard Brouer wrote: > > The tool xdp_hw_metadata can be used by driver developers > implementing XDP-hints kfuncs. The tool transfers the > XDP-hints via metadata information to an AF_XDP userspace > process. When everything works the bpf_printk calls are > unncesssary. Thus, disable bpf_printk by default, but > make it easy to reenable for driver developers to use > when debugging their driver implementation. > > This also converts bpf_printk "forwarding UDP:9091 to AF_XDP" > into a code comment. The bpf_printk's that are important > to the driver developers is when bpf_xdp_adjust_meta fails. > The likely mistake from driver developers is expected to > be that they didn't implement XDP metadata adjust support. > > Signed-off-by: Jesper Dangaard Brouer > --- > .../testing/selftests/bpf/progs/xdp_hw_metadata.c | 16 ++++++++++++++= -- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/= testing/selftests/bpf/progs/xdp_hw_metadata.c > index 4c55b4d79d3d..980eb60d8e5b 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > @@ -5,6 +5,19 @@ > #include > #include > > +/* Per default below bpf_printk() calls are disabled. Can be > + * reenabled manually for convenience by XDP-hints driver developer, > + * when troublshooting the drivers kfuncs implementation details. > + * > + * Remember BPF-prog bpf_printk info output can be access via: > + * /sys/kernel/debug/tracing/trace_pipe > + */ > +//#define DEBUG 1 > +#ifndef DEBUG > +#undef bpf_printk > +#define bpf_printk(fmt, ...) ({}) > +#endif Are you planning to eventually do somethike similar to what I've mentioned in [0]? If not, should I try to send a patch? 0: https://lore.kernel.org/netdev/CAKH8qBupRYEg+SPMTMb4h532GESG7P1QdaFJ-+zr= bARVN9xrdA@mail.gmail.com/ > + > struct { > __uint(type, BPF_MAP_TYPE_XSKMAP); > __uint(max_entries, 256); > @@ -49,11 +62,10 @@ int rx(struct xdp_md *ctx) > if (!udp) > return XDP_PASS; > > + /* Forwarding UDP:9091 to AF_XDP */ > if (udp->dest !=3D bpf_htons(9091)) > return XDP_PASS; > > - bpf_printk("forwarding UDP:9091 to AF_XDP"); > - > ret =3D bpf_xdp_adjust_meta(ctx, -(int)sizeof(struct xdp_meta)); > if (ret !=3D 0) { > bpf_printk("bpf_xdp_adjust_meta returned %d", ret); > >