Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/taskqueue.h
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | |||||
* must be locked with spinlocks since sleep mutex's cannot be used | * must be locked with spinlocks since sleep mutex's cannot be used | ||||
* from a fast interrupt handler context. | * from a fast interrupt handler context. | ||||
*/ | */ | ||||
TASKQUEUE_DECLARE(fast); | TASKQUEUE_DECLARE(fast); | ||||
struct taskqueue *taskqueue_create_fast(const char *name, int mflags, | struct taskqueue *taskqueue_create_fast(const char *name, int mflags, | ||||
taskqueue_enqueue_fn enqueue, | taskqueue_enqueue_fn enqueue, | ||||
void *context); | void *context); | ||||
/* | |||||
* Taskqueue groups. Manages dynamic thread groups and irq binding for | |||||
* device and other tasks. | |||||
*/ | |||||
int grouptaskqueue_enqueue(struct taskqueue *queue, struct task *task); | |||||
void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, | |||||
void *uniq, int irq, char *name); | |||||
int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, | |||||
void *uniq, int cpu, int irq, char *name); | |||||
void taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask); | |||||
struct taskqgroup *taskqgroup_create(char *name); | |||||
void taskqgroup_destroy(struct taskqgroup *qgroup); | |||||
int taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride); | |||||
#define TASK_SKIP_WAKEUP 0x1 | |||||
#define GTASK_INIT(task, priority, func, context) do { \ | |||||
(task)->ta_pending = 0; \ | |||||
(task)->ta_priority = (priority); \ | |||||
(task)->ta_func = (func); \ | |||||
(task)->ta_context = (context); \ | |||||
} while (0) | |||||
#define GROUPTASK_INIT(gtask, priority, func, context) \ | |||||
GTASK_INIT(&(gtask)->gt_task, priority, func, context) | |||||
#define GROUPTASK_ENQUEUE(gtask) \ | |||||
grouptaskqueue_enqueue((gtask)->gt_taskqueue, &(gtask)->gt_task) | |||||
#define TASKQGROUP_DECLARE(name) \ | |||||
extern struct taskqgroup *qgroup_##name | |||||
#ifdef EARLY_AP_STARTUP | |||||
#define TASKQGROUP_DEFINE(name, cnt, stride) \ | |||||
\ | |||||
struct taskqgroup *qgroup_##name; \ | |||||
\ | |||||
static void \ | |||||
taskqgroup_define_##name(void *arg) \ | |||||
{ \ | |||||
qgroup_##name = taskqgroup_create(#name); \ | |||||
taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ | |||||
} \ | |||||
\ | |||||
SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ | |||||
taskqgroup_define_##name, NULL) | |||||
#else | |||||
#define TASKQGROUP_DEFINE(name, cnt, stride) \ | |||||
\ | |||||
struct taskqgroup *qgroup_##name; \ | |||||
\ | |||||
static void \ | |||||
taskqgroup_define_##name(void *arg) \ | |||||
{ \ | |||||
qgroup_##name = taskqgroup_create(#name); \ | |||||
} \ | |||||
\ | |||||
SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ | |||||
taskqgroup_define_##name, NULL); \ | |||||
\ | |||||
static void \ | |||||
taskqgroup_adjust_##name(void *arg) \ | |||||
{ \ | |||||
taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ | |||||
} \ | |||||
\ | |||||
SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ | |||||
taskqgroup_adjust_##name, NULL); \ | |||||
\ | |||||
struct __hack | |||||
#endif | |||||
TASKQGROUP_DECLARE(net); | |||||
#endif /* !_SYS_TASKQUEUE_H_ */ | #endif /* !_SYS_TASKQUEUE_H_ */ |