![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 0002 /* 0003 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. 0004 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. 0005 */ 0006 0007 #ifndef RXE_TASK_H 0008 #define RXE_TASK_H 0009 0010 enum { 0011 TASK_STATE_START = 0, 0012 TASK_STATE_BUSY = 1, 0013 TASK_STATE_ARMED = 2, 0014 }; 0015 0016 /* 0017 * data structure to describe a 'task' which is a short 0018 * function that returns 0 as long as it needs to be 0019 * called again. 0020 */ 0021 struct rxe_task { 0022 void *obj; 0023 struct tasklet_struct tasklet; 0024 int state; 0025 spinlock_t state_lock; /* spinlock for task state */ 0026 void *arg; 0027 int (*func)(void *arg); 0028 int ret; 0029 char name[16]; 0030 bool destroyed; 0031 }; 0032 0033 /* 0034 * init rxe_task structure 0035 * arg => parameter to pass to fcn 0036 * func => function to call until it returns != 0 0037 */ 0038 int rxe_init_task(void *obj, struct rxe_task *task, 0039 void *arg, int (*func)(void *), char *name); 0040 0041 /* cleanup task */ 0042 void rxe_cleanup_task(struct rxe_task *task); 0043 0044 /* 0045 * raw call to func in loop without any checking 0046 * can call when tasklets are disabled 0047 */ 0048 int __rxe_do_task(struct rxe_task *task); 0049 0050 /* 0051 * common function called by any of the main tasklets 0052 * If there is any chance that there is additional 0053 * work to do someone must reschedule the task before 0054 * leaving 0055 */ 0056 void rxe_do_task(struct tasklet_struct *t); 0057 0058 /* run a task, else schedule it to run as a tasklet, The decision 0059 * to run or schedule tasklet is based on the parameter sched. 0060 */ 0061 void rxe_run_task(struct rxe_task *task, int sched); 0062 0063 /* keep a task from scheduling */ 0064 void rxe_disable_task(struct rxe_task *task); 0065 0066 /* allow task to run */ 0067 void rxe_enable_task(struct rxe_task *task); 0068 0069 #endif /* RXE_TASK_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |