pping: Refactor event handling code

Refactor code for how events are handled in the user space
application. Preparation for adding an additional event type which
should not be handled by the normal functions for printing RTT and
flow events.

Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
This commit is contained in:
Simon Sundberg
2022-02-03 16:28:10 +01:00
parent 32bdf11a96
commit 54886c92d9
2 changed files with 41 additions and 26 deletions

View File

@@ -93,10 +93,15 @@ struct packet_id {
};
/*
* An RTT event message that can be passed from the bpf-programs to user-space.
* Events that can be passed from the BPF-programs to the user space
* application.
* The initial event_type memeber is used to allow multiplexing between
* different event types in a single perf buffer. Memebers up to and including
* flow are identical to other event types.
* flow are identical for all event types.
*/
/*
* An RTT event message passed when an RTT has been calculated
* Uses explicit padding instead of packing based on recommendations in cilium's
* BPF reference documentation at https://docs.cilium.io/en/stable/bpf/#llvm.
*/
@@ -116,10 +121,7 @@ struct rtt_event {
};
/*
* A flow event message that can be passed from the bpf-programs to user-space.
* The initial event_type memeber is used to allow multiplexing between
* different event types in a single perf buffer. Memebers up to and including
* flow are identical to other event types.
* A flow event message passed when a flow has changed state (opened/closed)
*/
struct flow_event {
__u64 event_type;