[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKH8qBtZf1rHFH-JG1yJOBrH+on7g6WwOOu_vwbAaoD+vniCWQ@mail.gmail.com>
Date: Tue, 29 Nov 2022 10:52:00 -0800
From: Stanislav Fomichev <sdf@...gle.com>
To: Anton Protopopov <aspsk@...valent.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yhs@...com, john.fastabend@...il.com, kpsingh@...nel.org,
haoluo@...gle.com, jolsa@...nel.org,
David Ahern <dsahern@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 5/8] selftests/bpf: Verify xdp_metadata
xdp->af_xdp path
On Tue, Nov 29, 2022 at 2:06 AM Anton Protopopov <aspsk@...valent.com> wrote:
>
> On 22/11/21 10:25, Stanislav Fomichev wrote:
> >
> > [...]
> >
> > +
> > + if (bpf_xdp_metadata_rx_timestamp_supported(ctx))
> > + meta->rx_timestamp = bpf_xdp_metadata_rx_timestamp(ctx);
> > +
> > + if (bpf_xdp_metadata_rx_hash_supported(ctx))
> > + meta->rx_hash = bpf_xdp_metadata_rx_hash(ctx);
>
> Is there a case when F_supported and F are not called in a sequence? If not,
> then you can join them:
>
> bool (*ndo_xdp_rx_timestamp)(const struct xdp_md *ctx, u64 *timestamp);
>
> so that a calling XDP program does one indirect call instead of two for one
> field
>
> if (bpf_xdp_metadata_rx_timestamp(ctx, &meta->rx_timestamp)) {
> /* ... couldn't get the timestamp */
> }
The purpose of the original bpf_xdp_metadata_rx_hash_supported was to
allow unrolling and support dropping some dead branches by the
verifier.
Since there is still a chance we might eventually unroll some of
these, maybe it makes sense to keep as is?
Powered by blists - more mailing lists