blob: 717dab14322be5bef64b9205061169dd602bdaa3 [file] [log] [blame]
Alexei Starovoitovb0610172019-06-15 12:12:24 -07001// SPDX-License-Identifier: GPL-2.0
2// Copyright (c) 2019 Facebook
3#include <linux/sched.h>
4#include <linux/ptrace.h>
5#include <stdint.h>
6#include <stddef.h>
7#include <stdbool.h>
8#include <linux/bpf.h>
Toke Høiland-Jørgensen3e689142020-01-20 14:06:45 +01009#include <bpf/bpf_helpers.h>
10#include <bpf/bpf_tracing.h>
Alexei Starovoitovb0610172019-06-15 12:12:24 -070011
12char _license[] SEC("license") = "GPL";
13
14SEC("raw_tracepoint/consume_skb")
Andrii Nakryiko70bc7932022-01-06 12:51:56 -080015int while_true(struct pt_regs *ctx)
Alexei Starovoitovb0610172019-06-15 12:12:24 -070016{
Andrii Nakryiko70bc7932022-01-06 12:51:56 -080017 volatile __u64 i = 0, sum = 0;
Alexei Starovoitovb0610172019-06-15 12:12:24 -070018 do {
19 i++;
Ilya Leoshkevichaf3c24e2019-07-11 16:29:30 +020020 sum += PT_REGS_RC(ctx);
Alexei Starovoitovb0610172019-06-15 12:12:24 -070021 } while (i < 0x100000000ULL);
22 return sum;
23}