Lines Matching full:timer

13 	struct bpf_timer timer;  member
73 static int timer_cb1(void *map, int *key, struct bpf_timer *timer) in timer_cb1() argument
76 * Once via array timer callback and once via lru timer callback in timer_cb1()
80 /* *key == 0 - the callback was called for array timer. in timer_cb1()
81 * *key == 4 - the callback was called from lru timer. in timer_cb1()
87 /* rearm array timer to be called again in ~35 seconds */ in timer_cb1()
88 if (bpf_timer_start(timer, 1ull << 35, 0) != 0) in timer_cb1()
113 * element and force deletion of this timer in timer_cb1()
120 * which means that key/timer memory was reused in timer_cb1()
126 /* check that the timer was removed */ in timer_cb1()
127 if (bpf_timer_cancel(timer) != -EINVAL) in timer_cb1()
157 * doesn't leak timer memory. in BPF_PROG2()
175 /* re-arm the timer again to execute after 1 usec */ in timer_cb2()
176 bpf_timer_start(&val->timer, 1000, 0); in timer_cb2()
194 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
197 /* delete this key and this timer anyway. in timer_cb2()
207 if (bpf_timer_start(&val->timer, 1000, 0) != -EINVAL) in timer_cb2()
215 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
218 /* delete this key and this timer anyway. in timer_cb2()
235 if (bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
237 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
238 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
242 if (bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
244 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
245 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
260 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
261 /* update the same key to free the timer */ in BPF_PROG2()
267 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
268 /* update the same key to free the timer */ in BPF_PROG2()
272 * don't leak timer memory. in BPF_PROG2()
278 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
283 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
290 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
295 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
300 /* callback for absolute timer */
301 static int timer_cb3(void *map, int *key, struct bpf_timer *timer) in timer_cb3() argument
306 bpf_timer_start(timer, bpf_ktime_get_boot_ns() + 1000, in timer_cb3()
309 /* Re-arm timer ~35 seconds in future */ in timer_cb3()
310 bpf_timer_start(timer, bpf_ktime_get_boot_ns() + (1ull << 35), in timer_cb3()
321 struct bpf_timer *timer; in BPF_PROG2() local
325 timer = bpf_map_lookup_elem(&abs_timer, &key); in BPF_PROG2()
326 if (timer) { in BPF_PROG2()
327 if (bpf_timer_init(timer, &abs_timer, CLOCK_BOOTTIME) != 0) in BPF_PROG2()
329 bpf_timer_set_callback(timer, timer_cb3); in BPF_PROG2()
330 bpf_timer_start(timer, bpf_ktime_get_boot_ns() + 1000, in BPF_PROG2()
337 /* callback for pinned timer */
338 static int timer_cb_pinned(void *map, int *key, struct bpf_timer *timer) in timer_cb_pinned() argument
353 struct bpf_timer *timer; in test_pinned_timer() local
366 timer = bpf_map_lookup_elem(map, &key); in test_pinned_timer()
367 if (timer) { in test_pinned_timer()
368 if (bpf_timer_init(timer, map, CLOCK_BOOTTIME) != 0) in test_pinned_timer()
370 bpf_timer_set_callback(timer, timer_cb_pinned); in test_pinned_timer()
372 bpf_timer_start(timer, start_time + 1000, flags); in test_pinned_timer()
396 static int race_timer_callback(void *race_array, int *race_key, struct bpf_timer *timer) in race_timer_callback() argument
398 bpf_timer_start(timer, 1000000, 0); in race_timer_callback()
405 struct bpf_timer *timer; in race() local
412 timer = bpf_map_lookup_elem(&race_array, &race_key); in race()
413 if (!timer) in race()
416 err = bpf_timer_init(timer, &race_array, CLOCK_MONOTONIC); in race()
420 bpf_timer_set_callback(timer, race_timer_callback); in race()
421 bpf_timer_start(timer, 0, 0); in race()
422 bpf_timer_cancel(timer); in race()