diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 23 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 10 |
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; } |