svn commit: r329953 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Feb 25 10:18:03 UTC 2018
Author: hselasky
Date: Sun Feb 25 10:18:02 2018
New Revision: 329953
URL: https://svnweb.freebsd.org/changeset/base/329953
Log:
MFC r329376:
Implement tasklet_enable() and tasklet_disable() in the LinuxKPI.
Requested by: Johannes Lundberg <johalun0 at gmail.com>
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
stable/11/sys/compat/linuxkpi/common/src/linux_tasklet.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Sun Feb 25 10:15:52 2018 (r329952)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Sun Feb 25 10:18:02 2018 (r329953)
@@ -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_ */
Modified: stable/11/sys/compat/linuxkpi/common/src/linux_tasklet.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_tasklet.c Sun Feb 25 10:15:52 2018 (r329952)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_tasklet.c Sun Feb 25 10:18:02 2018 (r329953)
@@ -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)
@@ -195,4 +196,22 @@ tasklet_kill(struct tasklet_struct *ts)
/* wait until tasklet is no longer busy */
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);
+ }
}
More information about the svn-src-all
mailing list