netkit.h 1.2 KB

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