summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-11-12 14:11:16 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-11-12 14:11:16 +0000
commitada5306e598084a2b96783096ca767ab4ea51504 (patch)
tree1d141ff486caaa166ce74a19233020b5b8dd449b /sys/net
parentcf60d71f106bee325ba90eb84e06aec7cf6e2035 (diff)
Only use a single taskq to process incoming network packets as soon as
IPsec is enabled. This is currently a no-op since we still use a single taskq. But it will allows us to experiment with multiple forwarding threads and the PF_LOCK() without having to fix IPsec at the same time. ok sashan@, visa@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c23
-rw-r--r--sys/net/pfkeyv2.c10
2 files changed, 24 insertions, 9 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 3bdd998fc7b..df43465d00d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.525 2017/11/10 08:55:49 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.526 2017/11/12 14:11:15 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -228,8 +228,8 @@ int ifq_congestion;
int netisr;
-#define SOFTNET_TASKS 1
-struct taskq *softnettq[SOFTNET_TASKS];
+#define NET_TASKQ 1
+struct taskq *nettqmp[NET_TASKQ];
struct task if_input_task_locked = TASK_INITIALIZER(if_netisr, NULL);
@@ -255,10 +255,10 @@ ifinit(void)
timeout_set(&net_tick_to, net_tick, &net_tick_to);
- for (i = 0; i < SOFTNET_TASKS; i++) {
- softnettq[i] = taskq_create("softnet", 1, IPL_NET, TASKQ_MPSAFE);
- if (softnettq[i] == NULL)
- panic("unable to create softnet taskq");
+ for (i = 0; i < NET_TASKQ; i++) {
+ nettqmp[i] = taskq_create("softnet", 1, IPL_NET, TASKQ_MPSAFE);
+ if (nettqmp[i] == NULL)
+ panic("unable to create network taskq %d", i);
}
net_tick(&net_tick_to);
@@ -2925,12 +2925,19 @@ unhandled_af(int af)
panic("unhandled af %d", af);
}
+/*
+ * XXXSMP This tunable is here to work around the fact that IPsec
+ * globals aren't ready to be accessed by multiple threads in
+ * parallel.
+ */
+int nettaskqs = NET_TASKQ;
+
struct taskq *
net_tq(unsigned int ifindex)
{
struct taskq *t = NULL;
- t = softnettq[ifindex % SOFTNET_TASKS];
+ t = nettqmp[ifindex % nettaskqs];
return (t);
}
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 496f95ccea9..f80f98a7eb6 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.172 2017/11/03 16:23:20 florian Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.173 2017/11/12 14:11:15 mpi Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -1767,6 +1767,14 @@ pfkeyv2_send(struct socket *so, void *message, int len)
}
TAILQ_INSERT_HEAD(&ipsec_policy_head, ipo, ipo_list);
ipsec_in_use++;
+ /*
+ * XXXSMP IPsec data structures are not ready to be
+ * accessed by multiple Network threads in parallel,
+ * so force all packets to be processed by the first
+ * one.
+ */
+ extern int nettaskqs;
+ nettaskqs = 1;
} else {
ipo->ipo_last_searched = ipo->ipo_flags = 0;
}