Subject: Re: [PATCH bpf-next] bpf: Add BPF-helper for accessing CLOCK_TAI

From: Kurt Kanzenbach <[email-masked]>
Date: Thu, 04 Aug 2022 08:40:51 +0200

On Wed Aug 03 2022, Andrii Nakryiko wrote:
>> +void test_tai(void)
>> +{
>> +       struct __sk_buff skb = {
>> +               .tstamp = 0,
>> +               .hwtstamp = 0,
>> +       };
>> +       LIBBPF_OPTS(bpf_test_run_opts, topts,
>> +               .data_in = &pkt_v4,
>> +               .data_size_in = sizeof(pkt_v4),
>> +               .ctx_in = &skb,
>> +               .ctx_size_in = sizeof(skb),
>> +               .ctx_out = &skb,
>> +               .ctx_size_out = sizeof(skb),
>> +       );
>> +       struct timespec now_tai;
>> +       struct bpf_object *obj;
>> +       int ret, prog_fd;
>> +
>> +       ret = bpf_prog_test_load("./test_tai.o",
>> +                                BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd);
>
> it would be best to rely on BPF skeleton, please see other tests
> including *.skel.h, thanks
>

Ah, nice. Adjusted the test case accordingly. Will post v2 after the
merge window. Thanks!