@@ -2890,6 +2890,73 @@ union bpf_attr {
28902890 * Obtain the 64bit jiffies
28912891 * Return
28922892 * The 64 bit jiffies
2893+ *
2894+ * void bpf_lua_pcall(void *ctx, char *funcname, int num_args, int num_rets)
2895+ * Description
2896+ * Calls Lua function funcname with the given nargs arguments in protected mode
2897+ *
2898+ * void bpf_lua_pop(void *ctx, int n)
2899+ * Description
2900+ * Pops n elements from the Lua stack
2901+ *
2902+ * void bpf_lua_pushinteger(void *ctx, int num)
2903+ * Description
2904+ * Pushes an integer with value n onto the Lua stack.
2905+ *
2906+ * void bpf_lua_pushlightuserdata(void *ctx, void *ptr)
2907+ * Description
2908+ * Pushes a light userdata onto the Lua stack.
2909+ * Userdata represent C values in Lua.
2910+ * A light userdata represents a pointer, a void*.
2911+ * It is a value (like a number): you do not create it,
2912+ * it has no individual metatable, and it is not collected
2913+ * (as it was never created).
2914+ * A light userdata is equal to "any" light userdata with
2915+ * the same C address.
2916+ *
2917+ * void bpf_lua_pushlstring(void *ctx, const char *s, size_t len)
2918+ * Description
2919+ * Pushes the string pointed to by s with size len onto the stack.
2920+ * Lua makes (or reuses) an internal copy of the given string,
2921+ * so the memory at s can be freed or reused immediately after the
2922+ * function returns.
2923+ * The string can contain any binary data, including embedded zeros.
2924+ *
2925+ * void bpf_lua_pushmap(void *ctx, void *map)
2926+ * Description
2927+ * Pushes a BPF map onto the Lua stack
2928+ *
2929+ * void bpf_lua_pushskb(void *ctx)
2930+ * Description
2931+ * Pushes an SKB structure onto the Lua stack
2932+ *
2933+ * void bpf_lua_pushstring(void *ctx, const char *s)
2934+ * Description
2935+ * Pushes the zero-terminated string pointed to by s onto the stack.
2936+ * Lua makes (or reuses) an internal copy of the given string,
2937+ * so the memory at s can be freed or reused immediately after the
2938+ * function returns.
2939+ *
2940+ * void bpf_lua_setstate(void *ctx)
2941+ * Description
2942+ * Sets the Lua state pointer in the context struct
2943+ *
2944+ * int bpf_lua_toboolean(void *ctx, int index)
2945+ * Description
2946+ * Converts the Lua value at the given index to a C
2947+ * boolean value (0 or 1)
2948+ * Return
2949+ * 1 if the value in the given index of the Lua stack is
2950+ * different from from false or null, otherwise returns 0
2951+ *
2952+ * int bpf_lua_tointeger(void *ctx, int index)
2953+ * Description
2954+ * Converts the Lua value at the given index of the Lua stack
2955+ * to the signed integral type lua_Integer.
2956+ * Return
2957+ * The converted Lua value at the given index, if the value is
2958+ * convertible to an integer(see the Lua manual for more details
2959+ * on type conversion); otherwise returns 0
28932960 */
28942961#define __BPF_FUNC_MAPPER (FN ) \
28952962 FN(unspec), \
@@ -3010,7 +3077,20 @@ union bpf_attr {
30103077 FN(probe_read_kernel_str), \
30113078 FN(tcp_send_ack), \
30123079 FN(send_signal_thread), \
3013- FN(jiffies64),
3080+ FN(jiffies64), \
3081+ /* #ifdef CONFIG_XDP_LUA */ \
3082+ FN (lua_pcall ), \
3083+ FN (lua_pop ), \
3084+ FN (lua_pushinteger ), \
3085+ FN (lua_pushlightuserdata ), \
3086+ FN (lua_pushlstring ), \
3087+ FN (lua_pushmap ), \
3088+ FN (lua_pushskb ), \
3089+ FN (lua_pushstring ), \
3090+ FN (lua_setstate ), \
3091+ FN (lua_toboolean ), \
3092+ FN (lua_tointeger ),
3093+ /* #endif CONFIG_XDP_LUA */
30143094
30153095/* integer value in 'imm' field of BPF_CALL instruction selects which helper
30163096 * function eBPF program intends to call
0 commit comments