On Tue, Nov 29, 2022 at 2:06 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> 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?