All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Quentin Monnet <qmo@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Larysa Zaremba <larysa.zaremba@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 1/4] bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively
Date: Thu, 03 Sep 2026 09:53:50 +0200	[thread overview]
Message-ID: <87bjaevkhd.fsf@toke.dk> (raw)
In-Reply-To: <CAEf4BzacBUMLREUObGo5544wyD+mm1=y8ZTnzd7OdDL-c==mMA@mail.gmail.com>

Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:

> On Tue, Sep 1, 2026 at 1:47 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> When setting the XDP hints ifname, bpftool would set the
>> BPF_F_XDP_DEV_BOUND_ONLY without looking at the existing program flags,
>> overriding any other flag values. This was always a destructive action,
>> but after we change libbpf to carry the frags section flag in
>> prog_flags, this can impact bpftool loading of XDP frags programs.
>>
>> Change the flag setting to be non-destructive by OR'ing it with the
>> existing flags.
>>
>> Fixes: f46392ee3dec ("bpftool: Specify XDP Hints ifname when loading program")
>> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  tools/bpf/bpftool/prog.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
>> index a9f730d407a9..8c2f9255b36d 100644
>> --- a/tools/bpf/bpftool/prog.c
>> +++ b/tools/bpf/bpftool/prog.c
>> @@ -1769,7 +1769,7 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
>>                 }
>>
>>                 if (prog_type == BPF_PROG_TYPE_XDP && xdpmeta_ifindex) {
>> -                       bpf_program__set_flags(pos, BPF_F_XDP_DEV_BOUND_ONLY);
>> +                       bpf_program__set_flags(pos, bpf_program__flags(pos) | BPF_F_XDP_DEV_BOUND_ONLY);
>
> maybe we should just add bpf_program__add_flags() and
> bpf_program__clear_flags() to make life a touch easier and code in
> selftests and bpftool a touch less verbose?

Sure, I can follow up with those. Also makes for a convenient feature
detection target for this change :)

-Toke


  reply	other threads:[~2026-09-03  7:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  8:46 [PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags Toke Høiland-Jørgensen
2026-09-01  8:46 ` [PATCH bpf-next v3 1/4] bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively Toke Høiland-Jørgensen
2026-09-03  0:22   ` Andrii Nakryiko
2026-09-03  7:53     ` Toke Høiland-Jørgensen [this message]
2026-09-01  8:46 ` [PATCH bpf-next v3 2/4] selftests/bpf: Set BPF program flags non-destructively Toke Høiland-Jørgensen
2026-09-01  9:54   ` bot+bpf-ci
2026-09-01  8:46 ` [PATCH bpf-next v3 3/4] libbpf: Move section-defined program flags to prog_flags Toke Høiland-Jørgensen
2026-09-01  9:54   ` bot+bpf-ci
2026-09-03  0:22     ` Andrii Nakryiko
2026-09-01  8:46 ` [PATCH bpf-next v3 4/4] selftests/bpf: Check for flag presence in bpf_program__flags() Toke Høiland-Jørgensen
2026-09-01  8:56   ` sashiko-bot
2026-09-03  0:30 ` [PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjaevkhd.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=hawk@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=lorenzo@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=qmo@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.