summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/loop3.c
blob: 2b9165a7afe1903b6daebb2e9b8b30bc63c00249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <linux/bpf.h>
#include "bpf_helpers.h"
#include "bpf_tracing.h"

char _license[] SEC("license") = "GPL";

SEC("raw_tracepoint/consume_skb")
int while_true(volatile struct pt_regs* ctx)
{
	__u64 i = 0, sum = 0;
	do {
		i++;
		sum += PT_REGS_RC(ctx);
	} while (i < 0x100000000ULL);
	return sum;
}
OpenPOWER on IntegriCloud