| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright (c) 2023 Isovalent */ |
| 3 | #ifndef __NET_NETKIT_H |
| 4 | #define __NET_NETKIT_H |
| 5 | |
| 6 | #include <linux/bpf.h> |
| 7 | |
| 8 | #ifdef CONFIG_NETKIT |
| 9 | int netkit_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog); |
| 10 | int netkit_link_attach(const union bpf_attr *attr, struct bpf_prog *prog); |
| 11 | int netkit_prog_detach(const union bpf_attr *attr, struct bpf_prog *prog); |
| 12 | int netkit_prog_query(const union bpf_attr *attr, union bpf_attr __user *uattr); |
| 13 | INDIRECT_CALLABLE_DECLARE(struct net_device *netkit_peer_dev(struct net_device *dev)); |
| 14 | #else |
| 15 | static inline int netkit_prog_attach(const union bpf_attr *attr, |
| 16 | struct bpf_prog *prog) |
| 17 | { |
| 18 | return -EINVAL; |
| 19 | } |
| 20 | |
| 21 | static inline int netkit_link_attach(const union bpf_attr *attr, |
| 22 | struct bpf_prog *prog) |
| 23 | { |
| 24 | return -EINVAL; |
| 25 | } |
| 26 | |
| 27 | static inline int netkit_prog_detach(const union bpf_attr *attr, |
| 28 | struct bpf_prog *prog) |
| 29 | { |
| 30 | return -EINVAL; |
| 31 | } |
| 32 | |
| 33 | static inline int netkit_prog_query(const union bpf_attr *attr, |
| 34 | union bpf_attr __user *uattr) |
| 35 | { |
| 36 | return -EINVAL; |
| 37 | } |
| 38 | |
| 39 | static inline struct net_device *netkit_peer_dev(struct net_device *dev) |
| 40 | { |
| 41 | return NULL; |
| 42 | } |
| 43 | #endif /* CONFIG_NETKIT */ |
| 44 | #endif /* __NET_NETKIT_H */ |
| 45 | |