Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_tasklet.c
Show All 27 Lines | |||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/gtaskqueue.h> | #include <sys/gtaskqueue.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <linux/compiler.h> | #include <linux/compiler.h> | ||||
hselasky: I think this include is not needed. | |||||
#include <linux/interrupt.h> | #include <linux/interrupt.h> | ||||
#include <linux/compat.h> | #include <linux/compat.h> | ||||
#define TASKLET_ST_IDLE 0 | #define TASKLET_ST_IDLE 0 | ||||
#define TASKLET_ST_BUSY 1 | #define TASKLET_ST_BUSY 1 | ||||
#define TASKLET_ST_EXEC 2 | #define TASKLET_ST_EXEC 2 | ||||
#define TASKLET_ST_LOOP 3 | #define TASKLET_ST_LOOP 3 | ||||
Show All 12 Lines | struct tasklet_worker { | ||||
struct grouptask gtask; | struct grouptask gtask; | ||||
} __aligned(CACHE_LINE_SIZE); | } __aligned(CACHE_LINE_SIZE); | ||||
#define TASKLET_WORKER_LOCK(tw) mtx_lock(&(tw)->mtx) | #define TASKLET_WORKER_LOCK(tw) mtx_lock(&(tw)->mtx) | ||||
#define TASKLET_WORKER_UNLOCK(tw) mtx_unlock(&(tw)->mtx) | #define TASKLET_WORKER_UNLOCK(tw) mtx_unlock(&(tw)->mtx) | ||||
DPCPU_DEFINE_STATIC(struct tasklet_worker, tasklet_worker); | DPCPU_DEFINE_STATIC(struct tasklet_worker, tasklet_worker); | ||||
static void | static void | ||||
Not Done Inline ActionsNo need for this define. Just inline it. hselasky: No need for this define. Just inline it. | |||||
tasklet_handler(void *arg) | tasklet_handler(void *arg) | ||||
{ | { | ||||
struct tasklet_worker *tw = (struct tasklet_worker *)arg; | struct tasklet_worker *tw = (struct tasklet_worker *)arg; | ||||
struct tasklet_struct *ts; | struct tasklet_struct *ts; | ||||
struct tasklet_struct *last; | struct tasklet_struct *last; | ||||
linux_set_current(curthread); | linux_set_current(curthread); | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
tasklet_disable(struct tasklet_struct *ts) | tasklet_disable(struct tasklet_struct *ts) | ||||
{ | { | ||||
atomic_inc(&ts->count); | atomic_inc(&ts->count); | ||||
tasklet_unlock_wait(ts); | tasklet_unlock_wait(ts); | ||||
} | } | ||||
void | |||||
tasklet_disable_nosync(struct tasklet_struct *ts) | |||||
{ | |||||
atomic_inc(&ts->count); | |||||
barrier(); | |||||
} | |||||
int | int | ||||
tasklet_trylock(struct tasklet_struct *ts) | tasklet_trylock(struct tasklet_struct *ts) | ||||
{ | { | ||||
return (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_BUSY)); | return (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_BUSY)); | ||||
} | } | ||||
void | void | ||||
Show All 16 Lines |
I think this include is not needed.