From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by mail.toke.dk (Postfix) with ESMTPS id 42ACF86F1BE for ; Sat, 7 Aug 2021 01:14:59 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VWi9Dh7F Received: by mail-yb1-xb2e.google.com with SMTP id x192so18063483ybe.0 for ; Fri, 06 Aug 2021 16:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=khEElHuOI3DbPDFcMisbaPm5UlIpzLcnZqdY0D9rfns=; b=VWi9Dh7Fy08OhpMpxXK2vGmlhuJXYkV7lH2SLXr4Q882bUEc+Snv0m1b8zUyvUlUK/ UArX1OA95er3Kbmv/2RfMlWedc6AagpnCfJOOFC3FflflyHDtPZzuSIl+78WiE1xp2AT zvmGpBanFXJ3PEv7IhoxEEova4HExyvQ5lYJqtsj+nobUL1J0Hc596qQZcuPfropc8ex Xjb+mvDGxylZZrCLlxxDbG8gWCcuWuRY2DJrD91B8kZ3DBTgss0xfVrZMem50vbev5fp 544gGlGY/z5UV9GfcFVTNoGxTsaH6iMYwPHe4P9TcaCC1MxtHAF4QYTEB7wYJN+h/fCL n7lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=khEElHuOI3DbPDFcMisbaPm5UlIpzLcnZqdY0D9rfns=; b=Wb3V1qufGcSW2oh1KX0/S+FiI9daFC0c0esEumt5ZdsK+ro4y5SeUMoL5UoXxXqisa HnuDBT7ci1chPtQgqo8Oq1blTjTs3ZIIssCLFp0ckCdmqenlG78HSAdjNHBBALp7bLYR ytsduXGijalwAbRJ0UmW/YsCNH1qXspGCC4nQIxSr2hmmGcMmo8WQWTsAo4NCcLR/4RU tRrSkOX+RxRvpTLncWbDiNEZ9bOctYqXTdg/Hhztu+QpslvmUR3lyDmyk67waQVPqOPH shXUhCS8u44++CVfjgLDjZ5aNpwCI7wGyEWlZXEdIVxTMGG0UvawzkjNdda8ADs06WBv gXFA== X-Gm-Message-State: AOAM531bAw4GI0Uew0zcv91m6X6IHP0Mr1gVh0DBG5eeV0vwD2vo97nc 46FG9X4LEEiJOvuf2muxQFjoMvDGHEYHzfaSj3w= X-Google-Smtp-Source: ABdhPJzgl27GvQ47lQDq/q0SUzPC8oQpEblVxEvBZVrw9kmyUM30lWZc+WVaLYa1sv0a9Oo8fj99Z7DuvikIR9y8PPo= X-Received: by 2002:a25:d691:: with SMTP id n139mr16650954ybg.27.1628291698484; Fri, 06 Aug 2021 16:14:58 -0700 (PDT) MIME-Version: 1.0 References: <20210803010331.39453-1-ederson.desouza@intel.com> <20210803010331.39453-17-ederson.desouza@intel.com> In-Reply-To: <20210803010331.39453-17-ederson.desouza@intel.com> From: Andrii Nakryiko Date: Fri, 6 Aug 2021 16:14:47 -0700 Message-ID: Subject: Re: [[RFC xdp-hints] 16/16] samples/bpf: Show XDP hints usage To: Ederson de Souza Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: F7CDDTVUZI2KHMSCVSIJJTMKJVULMXGJ X-Message-ID-Hash: F7CDDTVUZI2KHMSCVSIJJTMKJVULMXGJ X-MailFrom: andrii.nakryiko@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: xdp-hints@xdp-project.net, bpf X-Mailman-Version: 3.3.4 Precedence: list List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, Aug 2, 2021 at 6:05 PM Ederson de Souza wrote: > > An example of how to retrieve XDP hints/metadata from an XDP frame. To > get the xdp_hints struct, one can use: > > $ bpftool net xdp show > xdp: > enp6s0(2) md_btf_id(44) md_btf_enabled(0) > > To get the BTF id, and then: > > $ bpftool btf dump id 44 format c > btf.h > > But, in this example, to demonstrate BTF and CORE features, a simpler > struct was defined, containing the only field used by the sample. > > A lowpoint is that it's not currently possible to use some CORE features > from "samples/bpf" directory, as those samples are currently built > without using "clang -target bpf". This way, it was not possible to use > "bpf_core_field_exists" macro to check, in runtime, the presence of a > given XDP hints field. > --- FYI, Kumar Kartikeya Dwivedi is adding vmlinux.h and CO-RE support to samples/bpf in [0]. [0] https://lore.kernel.org/bpf/20210728165552.435050-1-memxor@gmail.com/ > samples/bpf/xdp_sample_pkts_kern.c | 21 +++++++++++++++++++++ > samples/bpf/xdp_sample_pkts_user.c | 4 +++- > 2 files changed, 24 insertions(+), 1 deletion(-) > [...]