--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -210,6 +210,9 @@ enum bpf_func_id {
* Return: 0 on success
*/
BPF_FUNC_l4_csum_replace,
+
+ /* int bpf_output_data(void *src, int size, void *regs) */
+ BPF_FUNC_output_data,
__BPF_FUNC_MAX_ID,
};
+static u64 bpf_output_data(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5)
+{
+ void *src = (void *) (long) r1;
+ int dsize = (int) r2, __size, size;
+ void *regs = (void *) (long) r3;
+ __size = sizeof(*entry) + dsize;
+ size = ALIGN(__size + sizeof(u32), sizeof(u64));
+ size -= sizeof(u32);
+
+ entry = perf_trace_buf_prepare(size, TRACE_BPF, NULL, &rctx);
+ if (!entry)
+ return -ENOMEM;
+
+ entry->size = dsize;
(void *) BPF_FUNC_l4_csum_replace;
+static int (*bpf_output_data)(void *src, int size, void *regs) =
+ (void *) BPF_FUNC_output_data;