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, __u32 *hash,
9 				    enum xdp_rss_hash_type *rss_type) __ksym;
10 
11 int called;
12 
13 SEC("freplace/rx")
freplace_rx(struct xdp_md * ctx)14 int freplace_rx(struct xdp_md *ctx)
15 {
16 	enum xdp_rss_hash_type type = 0;
17 	u32 hash = 0;
18 	/* Call _any_ metadata function to make sure we don't crash. */
19 	bpf_xdp_metadata_rx_hash(ctx, &hash, &type);
20 	called++;
21 	return XDP_PASS;
22 }
23 
24 char _license[] SEC("license") = "GPL";
25