diff --git a/bpf/aya-bpf/src/maps/perf_map.rs b/bpf/aya-bpf/src/maps/perf_map.rs index b625e77c..212e2433 100644 --- a/bpf/aya-bpf/src/maps/perf_map.rs +++ b/bpf/aya-bpf/src/maps/perf_map.rs @@ -32,8 +32,8 @@ impl PerfMap { } } - pub fn output(&mut self, ctx: &C, data: &T) { - self.output_at_index(ctx, None, data, 0) + pub fn output(&mut self, ctx: &C, data: &T, flags: u32) { + self.output_at_index(ctx, None, data, flags) } pub fn output_at_index( @@ -43,10 +43,8 @@ impl PerfMap { data: &T, flags: u32, ) { - let index = index - .map(|i| (i as u64) << 32) - .unwrap_or(BPF_F_CURRENT_CPU.into()); - let flags = index | flags as u64; + let index = index.unwrap_or(BPF_F_CURRENT_CPU.into()) as u64; + let flags = (flags as u64) << 32 | index; unsafe { bpf_perf_event_output( ctx.as_ptr(),