1
2 #ifndef _LINUX_INDIRECT_CALL_WRAPPER_H
3 #define _LINUX_INDIRECT_CALL_WRAPPER_H
4
5 #ifdef CONFIG_RETPOLINE
6
7
8
9
10
11
12
13
14
15
16
17 #define INDIRECT_CALL_1(f, f1, ...) \
18 ({ \
19 likely(f == f1) ? f1(__VA_ARGS__) : f(__VA_ARGS__); \
20 })
21 #define INDIRECT_CALL_2(f, f2, f1, ...) \
22 ({ \
23 likely(f == f2) ? f2(__VA_ARGS__) : \
24 INDIRECT_CALL_1(f, f1, __VA_ARGS__); \
25 })
26
27 #define INDIRECT_CALLABLE_DECLARE(f) f
28 #define INDIRECT_CALLABLE_SCOPE
29
30 #else
31 #define INDIRECT_CALL_1(f, f1, ...) f(__VA_ARGS__)
32 #define INDIRECT_CALL_2(f, f2, f1, ...) f(__VA_ARGS__)
33 #define INDIRECT_CALLABLE_DECLARE(f)
34 #define INDIRECT_CALLABLE_SCOPE static
35 #endif
36
37
38
39
40
41
42 #if IS_BUILTIN(CONFIG_IPV6)
43 #define INDIRECT_CALL_INET(f, f2, f1, ...) \
44 INDIRECT_CALL_2(f, f2, f1, __VA_ARGS__)
45 #elif IS_ENABLED(CONFIG_INET)
46 #define INDIRECT_CALL_INET(f, f2, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)
47 #else
48 #define INDIRECT_CALL_INET(f, f2, f1, ...) f(__VA_ARGS__)
49 #endif
50
51 #endif