summaryrefslogtreecommitdiffstats
path: root/sys/net/netisr.c
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2015-04-08 20:25:51 +0000
committergnn <gnn@FreeBSD.org>2015-04-08 20:25:51 +0000
commit468eb00d1f5032272bb5cd2b5c7e409f0faeb9d7 (patch)
tree469b06446a684f32658f426a2f8ccf37ccd86c55 /sys/net/netisr.c
parent3de33e9ea56c1d5518b45d1406831899bf631fe0 (diff)
downloadFreeBSD-src-468eb00d1f5032272bb5cd2b5c7e409f0faeb9d7.zip
FreeBSD-src-468eb00d1f5032272bb5cd2b5c7e409f0faeb9d7.tar.gz
Add support for a netisr polling tunable, which allows run time switching of
device polling rather than having it only be controlled by the compile time option. Summary: Rubicon Communications (Netgate) Reviewers: #network, hiren Reviewed By: #network, hiren Subscribers: hiren Differential Revision: https://reviews.freebsd.org/D2258
Diffstat (limited to 'sys/net/netisr.c')
-rw-r--r--sys/net/netisr.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 178c3cb..f43ed34 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -126,6 +126,13 @@ static struct rmlock netisr_rmlock;
static SYSCTL_NODE(_net, OID_AUTO, isr, CTLFLAG_RW, 0, "netisr");
+#ifdef DEVICE_POLLING
+static int netisr_polling = 0; /* Enable Polling. */
+TUNABLE_INT("net.isr.polling_enable", &netisr_polling);
+SYSCTL_INT(_net_isr, OID_AUTO, polling_enable, CTLFLAG_RW,
+ &netisr_polling, 0, "Enable polling");
+#endif
+
/*-
* Three global direct dispatch policies are supported:
*
@@ -789,9 +796,11 @@ swi_net(void *arg)
nwsp = arg;
#ifdef DEVICE_POLLING
- KASSERT(nws_count == 1,
- ("%s: device_polling but nws_count != 1", __func__));
- netisr_poll();
+ if (netisr_polling) {
+ KASSERT(nws_count == 1,
+ ("%s: device_polling but nws_count != 1", __func__));
+ netisr_poll();
+ }
#endif
#ifdef NETISR_LOCKING
NETISR_RLOCK(&tracker);
@@ -816,7 +825,8 @@ out:
NETISR_RUNLOCK(&tracker);
#endif
#ifdef DEVICE_POLLING
- netisr_pollmore();
+ if (netisr_polling)
+ netisr_pollmore();
#endif
}
@@ -1071,6 +1081,9 @@ netisr_sched_poll(void)
{
struct netisr_workstream *nwsp;
+ if (!netisr_polling)
+ return;
+
nwsp = DPCPU_ID_PTR(nws_array[0], nws);
NWS_SIGNAL(nwsp);
}
@@ -1138,7 +1151,7 @@ netisr_init(void *arg)
* multiple netisr threads, so for the time being compiling in device
* polling disables parallel netisr workers.
*/
- if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
+ if (netisr_polling && (netisr_maxthreads != 1 || netisr_bindthreads != 0)) {
printf("netisr_init: forcing maxthreads to 1 and "
"bindthreads to 0 for device polling\n");
netisr_maxthreads = 1;
OpenPOWER on IntegriCloud