]> Git Repo - J-linux.git/blob - drivers/infiniband/sw/rxe/rxe_task.h
Merge tag 'amd-drm-next-6.5-2023-06-09' of https://gitlab.freedesktop.org/agd5f/linux...
[J-linux.git] / drivers / infiniband / sw / rxe / rxe_task.h
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
10 enum {
11         TASK_STATE_IDLE         = 0,
12         TASK_STATE_BUSY         = 1,
13         TASK_STATE_ARMED        = 2,
14         TASK_STATE_DRAINING     = 3,
15         TASK_STATE_DRAINED      = 4,
16         TASK_STATE_INVALID      = 5,
17 };
18
19 /*
20  * data structure to describe a 'task' which is a short
21  * function that returns 0 as long as it needs to be
22  * called again.
23  */
24 struct rxe_task {
25         struct tasklet_struct   tasklet;
26         int                     state;
27         spinlock_t              lock;
28         struct rxe_qp           *qp;
29         int                     (*func)(struct rxe_qp *qp);
30         int                     ret;
31         long                    num_sched;
32         long                    num_done;
33 };
34
35 /*
36  * init rxe_task structure
37  *      qp  => parameter to pass to func
38  *      func => function to call until it returns != 0
39  */
40 int rxe_init_task(struct rxe_task *task, struct rxe_qp *qp,
41                   int (*func)(struct rxe_qp *));
42
43 /* cleanup task */
44 void rxe_cleanup_task(struct rxe_task *task);
45
46 void rxe_run_task(struct rxe_task *task);
47
48 void rxe_sched_task(struct rxe_task *task);
49
50 /* keep a task from scheduling */
51 void rxe_disable_task(struct rxe_task *task);
52
53 /* allow task to run */
54 void rxe_enable_task(struct rxe_task *task);
55
56 #endif /* RXE_TASK_H */
This page took 0.029349 seconds and 4 git commands to generate.