0005-Add-missing-linux-bpf_common.h.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From 311e344039d58cfde09dd34f14804db8ac0513c9 Mon Sep 17 00:00:00 2001
  2. From: Peter Seiderer <ps.report@gmx.net>
  3. Date: Fri, 2 Nov 2018 18:58:53 +0100
  4. Subject: [PATCH] Add missing linux/bpf_common.h
  5. Copy from [1], needed by bpf.h.
  6. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19
  7. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  8. ---
  9. include/linux/bpf_common.h | 57 ++++++++++++++++++++++++++++++++++++++
  10. 1 file changed, 57 insertions(+)
  11. create mode 100644 include/linux/bpf_common.h
  12. diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h
  13. new file mode 100644
  14. index 00000000..ee97668b
  15. --- /dev/null
  16. +++ b/include/linux/bpf_common.h
  17. @@ -0,0 +1,57 @@
  18. +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  19. +#ifndef _UAPI__LINUX_BPF_COMMON_H__
  20. +#define _UAPI__LINUX_BPF_COMMON_H__
  21. +
  22. +/* Instruction classes */
  23. +#define BPF_CLASS(code) ((code) & 0x07)
  24. +#define BPF_LD 0x00
  25. +#define BPF_LDX 0x01
  26. +#define BPF_ST 0x02
  27. +#define BPF_STX 0x03
  28. +#define BPF_ALU 0x04
  29. +#define BPF_JMP 0x05
  30. +#define BPF_RET 0x06
  31. +#define BPF_MISC 0x07
  32. +
  33. +/* ld/ldx fields */
  34. +#define BPF_SIZE(code) ((code) & 0x18)
  35. +#define BPF_W 0x00 /* 32-bit */
  36. +#define BPF_H 0x08 /* 16-bit */
  37. +#define BPF_B 0x10 /* 8-bit */
  38. +/* eBPF BPF_DW 0x18 64-bit */
  39. +#define BPF_MODE(code) ((code) & 0xe0)
  40. +#define BPF_IMM 0x00
  41. +#define BPF_ABS 0x20
  42. +#define BPF_IND 0x40
  43. +#define BPF_MEM 0x60
  44. +#define BPF_LEN 0x80
  45. +#define BPF_MSH 0xa0
  46. +
  47. +/* alu/jmp fields */
  48. +#define BPF_OP(code) ((code) & 0xf0)
  49. +#define BPF_ADD 0x00
  50. +#define BPF_SUB 0x10
  51. +#define BPF_MUL 0x20
  52. +#define BPF_DIV 0x30
  53. +#define BPF_OR 0x40
  54. +#define BPF_AND 0x50
  55. +#define BPF_LSH 0x60
  56. +#define BPF_RSH 0x70
  57. +#define BPF_NEG 0x80
  58. +#define BPF_MOD 0x90
  59. +#define BPF_XOR 0xa0
  60. +
  61. +#define BPF_JA 0x00
  62. +#define BPF_JEQ 0x10
  63. +#define BPF_JGT 0x20
  64. +#define BPF_JGE 0x30
  65. +#define BPF_JSET 0x40
  66. +#define BPF_SRC(code) ((code) & 0x08)
  67. +#define BPF_K 0x00
  68. +#define BPF_X 0x08
  69. +
  70. +#ifndef BPF_MAXINSNS
  71. +#define BPF_MAXINSNS 4096
  72. +#endif
  73. +
  74. +#endif /* _UAPI__LINUX_BPF_COMMON_H__ */
  75. --
  76. 2.19.1