1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2022 Gerhard Engleder <gerhard@engleder-embedded.com> */
3 
4 #include <linux/if_vlan.h>
5 #include <net/xdp_sock_drv.h>
6 
7 #include "tsnep.h"
8 
9 int tsnep_xdp_setup_prog(struct tsnep_adapter *adapter, struct bpf_prog *prog,
10 			 struct netlink_ext_ack *extack)
11 {
12 	struct bpf_prog *old_prog;
13 
14 	old_prog = xchg(&adapter->xdp_prog, prog);
15 	if (old_prog)
16 		bpf_prog_put(old_prog);
17 
18 	return 0;
19 }
20