Projet

Général

Profil

Télécharger (2,44 ko) Statistiques
| Branche: | Révision:

univnautes-tools / patches / stable / 10 / netisr_default_values.diff @ 4ab3b90b

1
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
2
index 3045e95..015b840 100644
3
--- a/sys/net/netisr.c
4
+++ b/sys/net/netisr.c
5
@@ -126,6 +126,13 @@ static struct rmlock	netisr_rmlock;
6
 
7
 static SYSCTL_NODE(_net, OID_AUTO, isr, CTLFLAG_RW, 0, "netisr");
8
 
9
+#ifdef DEVICE_POLLING
10
+static int	netisr_polling = 0;	/* Enable Polling. */
11
+TUNABLE_INT("net.isr.polling_enable", &netisr_polling);
12
+SYSCTL_INT(_net_isr, OID_AUTO, polling_enable, CTLFLAG_RW,
13
+    &netisr_polling, 0, "Enable polling");
14
+#endif
15
+
16
 /*-
17
  * Three global direct dispatch policies are supported:
18
  *
19
@@ -165,7 +172,7 @@ SYSCTL_INT(_net_isr, OID_AUTO, maxthreads, CTLFLAG_RDTUN,
20
     &netisr_maxthreads, 0,
21
     "Use at most this many CPUs for netisr processing");
22
 
23
-static int	netisr_bindthreads = 0;		/* Bind threads to CPUs. */
24
+static int	netisr_bindthreads = 1;		/* Bind threads to CPUs. */
25
 TUNABLE_INT("net.isr.bindthreads", &netisr_bindthreads);
26
 SYSCTL_INT(_net_isr, OID_AUTO, bindthreads, CTLFLAG_RDTUN,
27
     &netisr_bindthreads, 0, "Bind netisr threads to CPUs.");
28
@@ -792,9 +799,11 @@ swi_net(void *arg)
29
 	nwsp = arg;
30
 
31
 #ifdef DEVICE_POLLING
32
-	KASSERT(nws_count == 1,
33
-	    ("%s: device_polling but nws_count != 1", __func__));
34
-	netisr_poll();
35
+	if (netisr_polling) {
36
+		KASSERT(nws_count == 1,
37
+		    ("%s: device_polling but nws_count != 1", __func__));
38
+		netisr_poll();
39
+	}
40
 #endif
41
 #ifdef NETISR_LOCKING
42
 	NETISR_RLOCK(&tracker);
43
@@ -819,7 +828,8 @@ out:
44
 	NETISR_RUNLOCK(&tracker);
45
 #endif
46
 #ifdef DEVICE_POLLING
47
-	netisr_pollmore();
48
+	if (netisr_polling)
49
+		netisr_pollmore();
50
 #endif
51
 }
52
 
53
@@ -1074,6 +1084,9 @@ netisr_sched_poll(void)
54
 {
55
 	struct netisr_workstream *nwsp;
56
 
57
+	if (!netisr_polling)
58
+		return;
59
+
60
 	nwsp = DPCPU_ID_PTR(nws_array[0], nws);
61
 	NWS_SIGNAL(nwsp);
62
 }
63
@@ -1128,7 +1141,7 @@ netisr_init(void *arg)
64
 
65
 	NETISR_LOCK_INIT();
66
 	if (netisr_maxthreads < 1)
67
-		netisr_maxthreads = 1;
68
+		netisr_maxthreads = mp_ncpus;
69
 	if (netisr_maxthreads > mp_ncpus) {
70
 		printf("netisr_init: forcing maxthreads from %d to %d\n",
71
 		    netisr_maxthreads, mp_ncpus);
72
@@ -1145,7 +1160,7 @@ netisr_init(void *arg)
73
 	 * multiple netisr threads, so for the time being compiling in device
74
 	 * polling disables parallel netisr workers.
75
 	 */
76
-	if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
77
+	if (netisr_polling && (netisr_maxthreads != 1 || netisr_bindthreads != 0)) {
78
 		printf("netisr_init: forcing maxthreads to 1 and "
79
 		    "bindthreads to 0 for device polling\n");
80
 		netisr_maxthreads = 1;
(35-35/67)