File Index
Files and directories
Sign in
FILE

rxe_task.h

File preview with syntax highlighting.

linux-6.19.14/drivers/infiniband/sw/rxe/rxe_task.h C
 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_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 */
24struct rxe_task {
25	struct work_struct	work;
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
35int rxe_alloc_wq(void);
36
37void rxe_destroy_wq(void);
38
39/*
40 * init rxe_task structure
41 *	qp  => parameter to pass to func
42 *	func => function to call until it returns != 0
43 */
44int rxe_init_task(struct rxe_task *task, struct rxe_qp *qp,
45		  int (*func)(struct rxe_qp *));
46
47/* cleanup task */
48void rxe_cleanup_task(struct rxe_task *task);
49
50void rxe_sched_task(struct rxe_task *task);
51
52/* keep a task from scheduling */
53void rxe_disable_task(struct rxe_task *task);
54
55/* allow task to run */
56void rxe_enable_task(struct rxe_task *task);
57
58#endif /* RXE_TASK_H */
~/ Read-only file preview.