Re: [PATCH bpf-next v3 11/15] selftests/xsk: get rid of built-in XDP program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ;)



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux