Lines Matching refs:timer

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