mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Implement tasklet_enable() and tasklet_disable() in the LinuxKPI.
MFC after: 1 week Requested by: Johannes Lundberg <johalun0@gmail.com> Sponsored by: Mellanox Technologies
This commit is contained in:
parent
16759360d4
commit
f1f7e04a29
2 changed files with 21 additions and 0 deletions
|
|
@ -200,5 +200,7 @@ extern void tasklet_schedule(struct tasklet_struct *);
|
|||
extern void tasklet_kill(struct tasklet_struct *);
|
||||
extern void tasklet_init(struct tasklet_struct *, tasklet_func_t *,
|
||||
unsigned long data);
|
||||
extern void tasklet_enable(struct tasklet_struct *);
|
||||
extern void tasklet_disable(struct tasklet_struct *);
|
||||
|
||||
#endif /* _LINUX_INTERRUPT_H_ */
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
|
|||
#define TASKLET_ST_BUSY 1
|
||||
#define TASKLET_ST_EXEC 2
|
||||
#define TASKLET_ST_LOOP 3
|
||||
#define TASKLET_ST_PAUSED 4
|
||||
|
||||
#define TASKLET_ST_CMPSET(ts, old, new) \
|
||||
atomic_cmpset_ptr((volatile uintptr_t *)&(ts)->entry.tqe_prev, old, new)
|
||||
|
|
@ -196,3 +197,21 @@ tasklet_kill(struct tasklet_struct *ts)
|
|||
while (TASKLET_ST_GET(ts) != TASKLET_ST_IDLE)
|
||||
pause("W", 1);
|
||||
}
|
||||
|
||||
void
|
||||
tasklet_enable(struct tasklet_struct *ts)
|
||||
{
|
||||
(void) TASKLET_ST_CMPSET(ts, TASKLET_ST_PAUSED, TASKLET_ST_IDLE);
|
||||
}
|
||||
|
||||
void
|
||||
tasklet_disable(struct tasklet_struct *ts)
|
||||
{
|
||||
while (1) {
|
||||
if (TASKLET_ST_GET(ts) == TASKLET_ST_PAUSED)
|
||||
break;
|
||||
if (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_PAUSED))
|
||||
break;
|
||||
pause("W", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue