1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <vmlinux.h>
4 #include "xdp_metadata.h"
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_endian.h>
7 
8 extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx,
9 				    __u32 *hash) __ksym;
10 
11 int called;
12 
13 SEC("freplace/rx")
14 int freplace_rx(struct xdp_md *ctx)
15 {
16 	u32 hash = 0;
17 	/* Call _any_ metadata function to make sure we don't crash. */
18 	bpf_xdp_metadata_rx_hash(ctx, &hash);
19 	called++;
20 	return XDP_PASS;
21 }
22 
23 char _license[] SEC("license") = "GPL";
24