[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-KFjcGq5DkCST1Cbx-bj4M7yE6LSz=uQWifZBba2HGFoA@mail.gmail.com>
Date: Tue, 13 Jun 2023 16:47:23 +0200
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Stanislav Fomichev <sdf@...gle.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, netdev@...r.kernel.org
Subject: Re: [RFC bpf-next 6/7] selftests/bpf: extend xdp_metadata with devtx kfuncs
On Mon, Jun 12, 2023 at 7:26 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> Attach kfuncs that request and report TX timestamp via ringbuf.
> Confirm on the userspace side that the program has triggered
> and the timestamp is non-zero.
>
> Also make sure devtx_frame has a sensible pointers and data.
>
> Cc: netdev@...r.kernel.org
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> +SEC("fentry/devtx_sb")
> +int BPF_PROG(devtx_sb, const struct devtx_frame *frame)
> +{
> + int ret;
> +
> + ret = verify_frame(frame);
> + if (ret < 0)
> + __sync_add_and_fetch(&pkts_fail_tx, 1);
intend to return in these error cases? in this and following patch
> +
> + ret = bpf_devtx_sb_request_timestamp(frame);
> + if (ret < 0)
> + __sync_add_and_fetch(&pkts_fail_tx, 1);
> +
> + return 0;
> +}
> +
> +SEC("fentry/devtx_cp")
> +int BPF_PROG(devtx_cp, const struct devtx_frame *frame)
> +{
> + struct devtx_sample *sample;
> + int ret;
> +
> + ret = verify_frame(frame);
> + if (ret < 0)
> + __sync_add_and_fetch(&pkts_fail_tx, 1);
> +
> + sample = bpf_ringbuf_reserve(&tx_compl_buf, sizeof(*sample), 0);
> + if (!sample)
> + return 0;
return non-zero?
> +
> + sample->timestamp_retval = bpf_devtx_cp_timestamp(frame, &sample->timestamp);
> +
> + bpf_ringbuf_submit(sample, 0);
> +
> + return 0;
> +}
Powered by blists - more mailing lists