blob: 9b2f808a2863732f7a3648ed6a875c1a93b57425 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001// 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>
9#include "bpf_helpers.h"
10
11char _license[] SEC("license") = "GPL";
12
13SEC("raw_tracepoint/consume_skb")
14int while_true(volatile struct pt_regs* ctx)
15{
16 int i = 0;
17
18 while (true) {
19 if (PT_REGS_RC(ctx) & 1)
20 i += 3;
21 else
22 i += 7;
23 if (i > 40)
24 break;
25 }
26
27 return i;
28}