Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 10:18:02 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r329953 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201802251018.w1PAI2e6007280@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);
+	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802251018.w1PAI2e6007280>