|
DPDK 26.07.0-rc2
|
#include <bpf_def.h>#include <rte_compat.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | rte_bpf_validate_debug_callback |
Typedefs | |
| typedef int(* | rte_bpf_validate_debug_point_process_t) (struct rte_bpf_validate_debug_point *point, void *ctx) |
Enumerations | |
| enum | rte_bpf_validate_debug_event |
Functions | |
| __rte_experimental struct rte_bpf_validate_debug * | rte_bpf_validate_debug_create (void) |
| __rte_experimental void | rte_bpf_validate_debug_destroy (struct rte_bpf_validate_debug *debug) |
| __rte_experimental struct rte_bpf_validate_debug_point * | rte_bpf_validate_debug_break (struct rte_bpf_validate_debug *debug, uint32_t pc, const struct rte_bpf_validate_debug_callback *callback) |
| __rte_experimental struct rte_bpf_validate_debug_point * | rte_bpf_validate_debug_catch (struct rte_bpf_validate_debug *debug, enum rte_bpf_validate_debug_event event, const struct rte_bpf_validate_debug_callback *callback) |
| __rte_experimental void | rte_bpf_validate_debug_point_destroy (struct rte_bpf_validate_debug_point *point) |
| __rte_experimental const struct rte_bpf_prm_ex * | rte_bpf_validate_debug_get_bpf_param (const struct rte_bpf_validate_debug *debug) |
| __rte_experimental int | rte_bpf_validate_debug_get_ins (const struct rte_bpf_validate_debug *debug, const struct ebpf_insn **ins, uint32_t *nb_ins) |
| __rte_experimental struct rte_bpf_validate_debug_point * | rte_bpf_validate_debug_get_last_point (const struct rte_bpf_validate_debug *debug) |
| __rte_experimental uint32_t | rte_bpf_validate_debug_get_pc (const struct rte_bpf_validate_debug *debug) |
| __rte_experimental int | rte_bpf_validate_debug_get_validation_result (const struct rte_bpf_validate_debug *debug, int *result) |
| __rte_experimental int | rte_bpf_validate_debug_can_access (const struct rte_bpf_validate_debug *debug, const struct ebpf_insn *access, uint64_t off64) |
| __rte_experimental int | rte_bpf_validate_debug_may_jump (const struct rte_bpf_validate_debug *debug, const struct ebpf_insn *jump, uint64_t imm64) |
| __rte_experimental int | rte_bpf_validate_debug_format_register_info (const struct rte_bpf_validate_debug *debug, char *buffer, size_t bufsz, uint8_t reg) |
| __rte_experimental int | rte_bpf_validate_debug_format_frame_info (const struct rte_bpf_validate_debug *debug, char *buffer, size_t bufsz, int32_t offset) |
| __rte_experimental int32_t | rte_bpf_validate_debug_get_frame_size (const struct rte_bpf_validate_debug *debug) |
| __rte_experimental int | rte_bpf_validate_debug_format_value (char *buffer, size_t bufsz, char format, uint64_t value) |
| __rte_experimental int | rte_bpf_validate_debug_format_interval (char *buffer, size_t bufsz, char format, uint64_t min, uint64_t max) |
Debugging interface for BPF validation.
Can be used for debugging BPF validation problems as well as in tests.
Definition in file rte_bpf_validate_debug.h.
| typedef int(* rte_bpf_validate_debug_point_process_t) (struct rte_bpf_validate_debug_point *point, void *ctx) |
Invoked by rte_bpf_validate_debug_for_each_point for each breakpoint and catchpoint.
Definition at line 68 of file rte_bpf_validate_debug.h.
Supported validate events.
Valid events begin from 0 and end before RTE_BPF_VALIDATE_DEBUG_EVENT_END.
Definition at line 35 of file rte_bpf_validate_debug.h.
| __rte_experimental struct rte_bpf_validate_debug * rte_bpf_validate_debug_create | ( | void | ) |
Create new debug instance.
| __rte_experimental void rte_bpf_validate_debug_destroy | ( | struct rte_bpf_validate_debug * | debug | ) |
Destroy debug instance.
Behavior is undefined if validation with this debug instance is ongoing.
| debug | Debug instance, or NULL. |
| __rte_experimental struct rte_bpf_validate_debug_point * rte_bpf_validate_debug_break | ( | struct rte_bpf_validate_debug * | debug, |
| uint32_t | pc, | ||
| const struct rte_bpf_validate_debug_callback * | callback | ||
| ) |
Create new breakpoint at specified location.
Can be called before the validation has started. If at validation start later the program will not have the specified instruction, the start will fail.
It is allowed to create breakpoints for the same location a callback is currently executing for, but it will not be invoked in the same cycle.
| debug | Debug instance. |
| pc | Program counter to create breakpoint at. |
| callback | Callback to invoke. |
| __rte_experimental struct rte_bpf_validate_debug_point * rte_bpf_validate_debug_catch | ( | struct rte_bpf_validate_debug * | debug, |
| enum rte_bpf_validate_debug_event | event, | ||
| const struct rte_bpf_validate_debug_callback * | callback | ||
| ) |
Create new catchpoint for specified event.
Can be called before the validation has started.
It is allowed to create catchpoints for the same event a callback is currently executing for, but it will not be invoked in the same cycle.
| debug | Debug instance. |
| event | Validation event to create catchpoint for. |
| callback | Callback to invoke. |
| __rte_experimental void rte_bpf_validate_debug_point_destroy | ( | struct rte_bpf_validate_debug_point * | point | ) |
Delete breakpoint or catchpoint and free all associated resources.
If a callback is currently being executed, calling this API is allowed for:
| point | Breakpoint or catchpoint to destroy, or NULL. |
| __rte_experimental const struct rte_bpf_prm_ex * rte_bpf_validate_debug_get_bpf_param | ( | const struct rte_bpf_validate_debug * | debug | ) |
Get effective eBPF parameters struct.
| debug | Debug instance. |
| __rte_experimental int rte_bpf_validate_debug_get_ins | ( | const struct rte_bpf_validate_debug * | debug, |
| const struct ebpf_insn ** | ins, | ||
| uint32_t * | nb_ins | ||
| ) |
Get pointer to effective eBPF program instructions.
| debug | Debug instance. |
| ins | Upon return, program instructions with all patches and relocations applied. |
| nb_ins | Upon return, number of program instructions. |
| __rte_experimental struct rte_bpf_validate_debug_point * rte_bpf_validate_debug_get_last_point | ( | const struct rte_bpf_validate_debug * | debug | ) |
Get last triggered breakpoint or catchpoint.
Can be used to destroy currently processed breakpoint or catchpoint.
The pointer may be invalid if the breakpoint or catchpoint has already been destroyed earlier.
| debug | Debug instance. |
| __rte_experimental uint32_t rte_bpf_validate_debug_get_pc | ( | const struct rte_bpf_validate_debug * | debug | ) |
Get current instruction index, or one after last if finishing.
| debug | Debug instance. |
| __rte_experimental int rte_bpf_validate_debug_get_validation_result | ( | const struct rte_bpf_validate_debug * | debug, |
| int * | result | ||
| ) |
Get the validation result, if it has finished.
| debug | Debug instance. |
| result | Upon successful return, the validation result (negative if validation failed). |
| __rte_experimental int rte_bpf_validate_debug_can_access | ( | const struct rte_bpf_validate_debug * | debug, |
| const struct ebpf_insn * | access, | ||
| uint64_t | off64 | ||
| ) |
Check if specified memory access instruction is currently valid.
| debug | Debug instance. |
| access | Memory load or store eBPF instruction. |
| off64 | Additional 64-bit offset added to ins->off. |
| __rte_experimental int rte_bpf_validate_debug_may_jump | ( | const struct rte_bpf_validate_debug * | debug, |
| const struct ebpf_insn * | jump, | ||
| uint64_t | imm64 | ||
| ) |
Get possible truth values of the specified jump condition.
| debug | Debug instance. |
| jump | Conditional jump instruction specifying the condition. |
| imm64 | Additional 64-bit immediate added to the source. |
| __rte_experimental int rte_bpf_validate_debug_format_register_info | ( | const struct rte_bpf_validate_debug * | debug, |
| char * | buffer, | ||
| size_t | bufsz, | ||
| uint8_t | reg | ||
| ) |
Format information about specified register for the user.
Parameters buffer, bufsz and return value work the same way as for snprintf.
| debug | Debug instance. |
| buffer | Buffer to fill with register information. |
| bufsz | Buffer size (including space for terminating zero). |
| reg | Register to provide information about. |
| __rte_experimental int rte_bpf_validate_debug_format_frame_info | ( | const struct rte_bpf_validate_debug * | debug, |
| char * | buffer, | ||
| size_t | bufsz, | ||
| int32_t | offset | ||
| ) |
Format information about specified stack frame location for the user.
Parameters buffer, bufsz and return value work the same way as for snprintf.
| debug | Debug instance. |
| buffer | Buffer to fill with register information. |
| bufsz | Buffer size (including space for terminating zero). |
| offset | Stack frame offset to provide information about, in bytes. Typically a negative multiple of 8. |
| __rte_experimental int32_t rte_bpf_validate_debug_get_frame_size | ( | const struct rte_bpf_validate_debug * | debug | ) |
Get program stack frame size.
| debug | Debug instance. |
| __rte_experimental int rte_bpf_validate_debug_format_value | ( | char * | buffer, |
| size_t | bufsz, | ||
| char | format, | ||
| uint64_t | value | ||
| ) |
Format value following the style of register format function.
Parameters buffer, bufsz and return value work the same way as for snprintf.
| buffer | Buffer to fill with register information. |
| bufsz | Buffer size (including space for terminating zero). |
| format | One of characters 'd' or 'x' for signed or hexadecimal format. |
| value | Formatted value, can be signed typecast to unsigned. |
| __rte_experimental int rte_bpf_validate_debug_format_interval | ( | char * | buffer, |
| size_t | bufsz, | ||
| char | format, | ||
| uint64_t | min, | ||
| uint64_t | max | ||
| ) |
Format interval following the style of register format function.
Parameters buffer, bufsz and return value work the same way as for snprintf.
| buffer | Buffer to fill with register information. |
| bufsz | Buffer size (including space for terminating zero). |
| format | One of characters 'd' or 'x' for signed or hexadecimal format. |
| min | Minimum value of the interval, can be signed typecast to unsigned. |
| max | Maximum value of the interval, can be signed typecast to unsigned. |