-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xdp-bench/tests: skip xdp_load_bytes test if the kernel doesn't suppo…
…rt it Add detection of whether the kernel supports the xdp_load_bytes helper and skip the test if it isn't supported. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
- Loading branch information
Showing
7 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
UTIL_OBJS := params.o logging.o util.o stats.o xpcapng.o xdp_sample.o | ||
UTIL_BPF_OBJS := xdp_sample.bpf.o | ||
UTIL_BPF_OBJS := xdp_sample.bpf.o xdp_load_bytes.bpf.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
|
||
#include <linux/bpf.h> | ||
#include <bpf/bpf_helpers.h> | ||
|
||
#ifndef HAVE_LIBBPF_BPF_PROGRAM__TYPE | ||
static long (*bpf_xdp_load_bytes)(struct xdp_md *xdp_md, __u32 offset, void *buf, __u32 len) = (void *) 189; | ||
#endif | ||
|
||
SEC("xdp") | ||
int xdp_probe_prog(struct xdp_md *ctx) | ||
{ | ||
__u8 buf[10]; | ||
int err; | ||
|
||
err = bpf_xdp_load_bytes(ctx, 0, buf, sizeof(buf)); | ||
if (err) | ||
return XDP_ABORTED; | ||
|
||
return XDP_PASS; | ||
} | ||
|
||
char _license[] SEC("license") = "GPL"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters