Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2/*
3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
5 */
6
7#ifndef RXE_TASK_H
8#define RXE_TASK_H
9
10enum {
11 TASK_STATE_START = 0,
12 TASK_STATE_BUSY = 1,
13 TASK_STATE_ARMED = 2,
14};
15
16/*
17 * data structure to describe a 'task' which is a short
18 * function that returns 0 as long as it needs to be
19 * called again.
20 */
21struct rxe_task {
22 struct tasklet_struct tasklet;
23 int state;
24 spinlock_t lock;
25 void *arg;
26 int (*func)(void *arg);
27 int ret;
28 bool destroyed;
29};
30
31/*
32 * init rxe_task structure
33 * arg => parameter to pass to fcn
34 * func => function to call until it returns != 0
35 */
36int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *));
37
38/* cleanup task */
39void rxe_cleanup_task(struct rxe_task *task);
40
41/*
42 * raw call to func in loop without any checking
43 * can call when tasklets are disabled
44 */
45int __rxe_do_task(struct rxe_task *task);
46
47void rxe_run_task(struct rxe_task *task);
48
49void rxe_sched_task(struct rxe_task *task);
50
51/* keep a task from scheduling */
52void rxe_disable_task(struct rxe_task *task);
53
54/* allow task to run */
55void rxe_enable_task(struct rxe_task *task);
56
57#endif /* RXE_TASK_H */