1140172Sstefanf// SPDX-License-Identifier: GPL-2.0
2140172Sstefanf
3140172Sstefanf#include <vmlinux.h>
4140172Sstefanf#include "xdp_metadata.h"
5140172Sstefanf#include <bpf/bpf_helpers.h>
6140172Sstefanf#include <bpf/bpf_endian.h>
7140172Sstefanf
8140172Sstefanfextern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash,
9140172Sstefanf				    enum xdp_rss_hash_type *rss_type) __ksym;
10140172Sstefanf
11140172Sstefanfint called;
12140172Sstefanf
13140172SstefanfSEC("freplace/rx")
14176245Sbdeint freplace_rx(struct xdp_md *ctx)
15176245Sbde{
16140172Sstefanf	enum xdp_rss_hash_type type = 0;
17140172Sstefanf	u32 hash = 0;
18140172Sstefanf	/* Call _any_ metadata function to make sure we don't crash. */
19140172Sstefanf	bpf_xdp_metadata_rx_hash(ctx, &hash, &type);
20140172Sstefanf	called++;
21140172Sstefanf	return XDP_PASS;
22140172Sstefanf}
23140172Sstefanf
24140172Sstefanfchar _license[] SEC("license") = "GPL";
25140172Sstefanf