[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230112021619.m34yf7wf2visdmac@MacBook-Pro-6.local>
Date: Wed, 11 Jan 2023 18:16:19 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Magnus Karlsson <magnus.karlsson@...il.com>
Cc: magnus.karlsson@...el.com, bjorn@...nel.org, ast@...nel.org,
daniel@...earbox.net, netdev@...r.kernel.org,
maciej.fijalkowski@...el.com, bpf@...r.kernel.org, yhs@...com,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...gle.com,
haoluo@...gle.com, jolsa@...nel.org, tirthendu.sarkar@...el.com,
jonathan.lemon@...il.com
Subject: Re: [PATCH bpf-next v3 11/15] selftests/xsk: get rid of built-in XDP
program
On Wed, Jan 11, 2023 at 10:35:22AM +0100, Magnus Karlsson wrote:
> +xsk_xdp_progs.skel.h-deps := xsk_xdp_progs.bpf.o
...
> diff --git a/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
> new file mode 100644
> index 000000000000..698176882ac6
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
> @@ -0,0 +1,19 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2022 Intel */
> +
> +#include <linux/bpf.h>
> +#include <bpf/bpf_helpers.h>
> +
> +struct {
> + __uint(type, BPF_MAP_TYPE_XSKMAP);
> + __uint(max_entries, 1);
> + __uint(key_size, sizeof(int));
> + __uint(value_size, sizeof(int));
> +} xsk SEC(".maps");
> +
> +SEC("xdp") int xsk_def_prog(struct xdp_md *xdp)
> +{
> + return bpf_redirect_map(&xsk, 0, XDP_DROP);
> +}
...
> +#include "xsk_xdp_progs.skel.h"
Nice. Glad you found it useful. Clearly helps the next patch ;)
Powered by blists - more mailing lists