From: Marat Khalili <qm2k21@gmail.com>
To: Konstantin Ananyev <konstantin.ananyev@huawei.com>,
Marat Khalili <qm2k21@gmail.com>
Cc: dev@dpdk.org, Marat Khalili <marat.khalili@huawei.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v4 5/7] bpf/validate: add get current event API
Date: Thu, 17 Sep 2026 14:35:35 +0000 [thread overview]
Message-ID: <20260917143539.46951-6-qm2k21@gmail.com> (raw)
In-Reply-To: <20260917143539.46951-1-qm2k21@gmail.com>
From: Marat Khalili <marat.khalili@huawei.com>
Add API for retrieving the event currently processed by a callback.
Useful when single callback is registered for multiple events to put
less pressure on the context argument.
Signed-off-by: Marat Khalili <marat.khalili@huawei.com>
---
lib/bpf/bpf_validate_debug.c | 13 +++++++++++++
lib/bpf/rte_bpf_validate_debug.h | 13 +++++++++++++
2 files changed, 26 insertions(+)
diff --git a/lib/bpf/bpf_validate_debug.c b/lib/bpf/bpf_validate_debug.c
index 098a88026d..c8e9e5dd92 100644
--- a/lib/bpf/bpf_validate_debug.c
+++ b/lib/bpf/bpf_validate_debug.c
@@ -43,6 +43,7 @@ struct rte_bpf_validate_debug {
const struct bpf_verifier *verifier;
const struct rte_bpf_prm_ex *bpf_prm;
struct point_list *breakpoint_lists;
+ enum rte_bpf_validate_debug_event current_event;
struct rte_bpf_validate_debug_point *last_point;
uint32_t pc;
/* Evaluate stage (only tracking `evaluate` part at the moment). */
@@ -236,6 +237,7 @@ debug_trigger_breakpoints(struct rte_bpf_validate_debug *debug, uint32_t pc)
static int
debug_send_event(struct rte_bpf_validate_debug *debug, debug_event_t event)
{
+ debug->current_event = event;
return debug_points_call_back(debug, &debug->catchpoint_lists[event]);
}
@@ -342,6 +344,17 @@ rte_bpf_validate_debug_get_ins(const struct rte_bpf_validate_debug *debug,
return 0;
}
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bpf_validate_debug_get_event, 26.11)
+enum rte_bpf_validate_debug_event
+rte_bpf_validate_debug_get_event(const struct rte_bpf_validate_debug *debug)
+{
+ if (debug == NULL)
+ /* Just to be fool-proof, not really required by API. */
+ return -EINVAL;
+
+ return debug->current_event;
+}
+
RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bpf_validate_debug_get_last_point, 26.07)
struct rte_bpf_validate_debug_point *
rte_bpf_validate_debug_get_last_point(const struct rte_bpf_validate_debug *debug)
diff --git a/lib/bpf/rte_bpf_validate_debug.h b/lib/bpf/rte_bpf_validate_debug.h
index f1ee8769d0..6d4bf53589 100644
--- a/lib/bpf/rte_bpf_validate_debug.h
+++ b/lib/bpf/rte_bpf_validate_debug.h
@@ -194,6 +194,19 @@ int
rte_bpf_validate_debug_get_ins(const struct rte_bpf_validate_debug *debug,
const struct ebpf_insn **ins, uint32_t *nb_ins);
+/**
+ * Get event currently processed by a catchpoint callback.
+ *
+ * @param debug
+ * Debug instance.
+ * @return
+ * Event currently processed by a catchpoint callback.
+ * Undefined if no event is currently being processed.
+ */
+__rte_experimental
+enum rte_bpf_validate_debug_event
+rte_bpf_validate_debug_get_event(const struct rte_bpf_validate_debug *debug);
+
/**
* Get last triggered breakpoint or catchpoint.
*
--
2.43.0
next prev parent reply other threads:[~2026-09-17 14:37 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 10:39 [PATCH 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-11 10:39 ` [PATCH 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-11 10:40 ` [PATCH 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-11 10:40 ` [PATCH 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-11 10:40 ` [PATCH 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-11 10:40 ` [PATCH 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-11 10:40 ` [PATCH 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-11 10:40 ` [PATCH 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-14 14:54 ` [PATCH v2 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-14 14:54 ` [PATCH v2 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-14 14:54 ` [PATCH v2 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-14 14:54 ` [PATCH v2 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-14 14:54 ` [PATCH v2 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-14 14:54 ` [PATCH v2 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-14 14:54 ` [PATCH v2 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-14 14:54 ` [PATCH v2 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-14 18:41 ` Stephen Hemminger
2026-09-15 13:13 ` Stephen Hemminger
2026-09-14 18:42 ` [PATCH v2 0/7] validate-bpf: add standalone validation debug tool Stephen Hemminger
2026-09-15 19:27 ` Marat Khalili
2026-09-15 19:26 ` [PATCH v3 " Marat Khalili
2026-09-15 19:26 ` [PATCH v3 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-15 19:26 ` [PATCH v3 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-15 19:26 ` [PATCH v3 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-15 19:26 ` [PATCH v3 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-15 19:26 ` [PATCH v3 5/7] bpf/validate: add get current event API Marat Khalili
2026-09-15 19:26 ` [PATCH v3 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-15 19:26 ` [PATCH v3 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-16 16:36 ` Konstantin Ananyev
2026-09-17 14:35 ` [PATCH v4 0/7] validate-bpf: add standalone validation debug tool Marat Khalili
2026-09-17 14:35 ` [PATCH v4 1/7] bpf/validate: fix finished status on restart Marat Khalili
2026-09-17 14:35 ` [PATCH v4 2/7] bpf/validate: refactor internal step function Marat Khalili
2026-09-17 14:35 ` [PATCH v4 3/7] bpf/validate: formalize call back requirements Marat Khalili
2026-09-17 14:35 ` [PATCH v4 4/7] bpf/validate: add jump notification events Marat Khalili
2026-09-17 14:35 ` Marat Khalili [this message]
2026-09-17 14:35 ` [PATCH v4 6/7] app/test: add test for bpf validate debug events Marat Khalili
2026-09-17 14:35 ` [PATCH v4 7/7] app/validate-bpf: add BPF validation application Marat Khalili
2026-09-17 16:16 ` [PATCH v4 0/7] validate-bpf: add standalone validation debug tool Konstantin Ananyev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917143539.46951-6-qm2k21@gmail.com \
--to=qm2k21@gmail.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=marat.khalili@huawei.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox