1*939b9c68SZvi Effron // SPDX-License-Identifier: GPL-2.0 2*939b9c68SZvi Effron #include <linux/bpf.h> 3*939b9c68SZvi Effron #include <bpf/bpf_helpers.h> 4*939b9c68SZvi Effron 5*939b9c68SZvi Effron SEC("xdp") xdp_context(struct xdp_md * xdp)6*939b9c68SZvi Effronint xdp_context(struct xdp_md *xdp) 7*939b9c68SZvi Effron { 8*939b9c68SZvi Effron void *data = (void *)(long)xdp->data; 9*939b9c68SZvi Effron __u32 *metadata = (void *)(long)xdp->data_meta; 10*939b9c68SZvi Effron __u32 ret; 11*939b9c68SZvi Effron 12*939b9c68SZvi Effron if (metadata + 1 > data) 13*939b9c68SZvi Effron return XDP_ABORTED; 14*939b9c68SZvi Effron ret = *metadata; 15*939b9c68SZvi Effron if (bpf_xdp_adjust_meta(xdp, 4)) 16*939b9c68SZvi Effron return XDP_ABORTED; 17*939b9c68SZvi Effron return ret; 18*939b9c68SZvi Effron } 19*939b9c68SZvi Effron 20*939b9c68SZvi Effron char _license[] SEC("license") = "GPL"; 21