1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
17 * data structure to describe a 'task' which is a short
18 * function that returns 0 as long as it needs to be
22 struct tasklet_struct tasklet;
24 spinlock_t state_lock; /* spinlock for task state */
26 int (*func)(void *arg);
32 * init rxe_task structure
33 * arg => parameter to pass to fcn
34 * func => function to call until it returns != 0
36 int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *));
39 void rxe_cleanup_task(struct rxe_task *task);
42 * raw call to func in loop without any checking
43 * can call when tasklets are disabled
45 int __rxe_do_task(struct rxe_task *task);
48 * common function called by any of the main tasklets
49 * If there is any chance that there is additional
50 * work to do someone must reschedule the task before
53 void rxe_do_task(struct tasklet_struct *t);
55 /* run a task, else schedule it to run as a tasklet, The decision
56 * to run or schedule tasklet is based on the parameter sched.
58 void rxe_run_task(struct rxe_task *task, int sched);
60 /* keep a task from scheduling */
61 void rxe_disable_task(struct rxe_task *task);
63 /* allow task to run */
64 void rxe_enable_task(struct rxe_task *task);
66 #endif /* RXE_TASK_H */