Commit 042b1545 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by Alexei Starovoitov
Browse files

bpf: Selftests and tools use struct bpf_devmap_val from uapi



Sync tools uapi bpf.h header file and update selftests that use
struct bpf_devmap_val.

Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/159170951195.2102545.1833108712124273987.stgit@firesoul
parent 281920b7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3761,6 +3761,19 @@ struct xdp_md {
	__u32 egress_ifindex;  /* txq->dev->ifindex */
};

/* DEVMAP map-value layout
 *
 * The struct data-layout of map-value is a configuration interface.
 * New members can only be added to the end of this structure.
 */
struct bpf_devmap_val {
	__u32 ifindex;   /* device index */
	union {
		int   fd;  /* prog fd on map write */
		__u32 id;  /* prog id on map read */
	} bpf_prog;
};

enum sk_action {
	SK_DROP = 0,
	SK_PASS,
+0 −8
Original line number Diff line number Diff line
@@ -8,14 +8,6 @@

#define IFINDEX_LO 1

struct bpf_devmap_val {
	u32 ifindex;   /* device index */
	union {
		int fd;  /* prog fd on map write */
		u32 id;  /* prog id on map read */
	} bpf_prog;
};

void test_xdp_with_devmap_helpers(void)
{
	struct test_xdp_with_devmap_helpers *skel;
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/* fails to load without expected_attach_type = BPF_XDP_DEVMAP
 * because of access to egress_ifindex
 */
#include "vmlinux.h"
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

SEC("xdp_dm_log")
+1 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0

#include "vmlinux.h"
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

struct {