diff options
author | 2017-02-07 17:25:45 +0000 | |
---|---|---|
committer | 2017-02-07 17:25:45 +0000 | |
commit | e410e70d23f72ad4c503f395ca0443e81460573b (patch) | |
tree | 745d19665eb650984c84f1d62eabc70e4ada9d59 /sys/netinet/ip_ipcomp.c | |
parent | DECSLRM in xterm(1) appears to have a quirk where it can generate an (diff) | |
download | wireguard-openbsd-e410e70d23f72ad4c503f395ca0443e81460573b.tar.xz wireguard-openbsd-e410e70d23f72ad4c503f395ca0443e81460573b.zip |
Reduce the per-packet allocation costs for crypto operations (cryptop)
by pre-allocating two cryptodesc objects and storing them in an array
instead of a linked list. If more than two cryptodesc objects are
required use mallocarray to fetch them. Adapt the drivers to the new
API.
This change results in one pool-get per ESP packet instead of three.
It also simplifies softraid crypto where more cryptodesc objects are
allocated than used.
From, with and ok markus@, ok bluhm@
"looks sane" mpi@
Diffstat (limited to 'sys/netinet/ip_ipcomp.c')
-rw-r--r-- | sys/netinet/ip_ipcomp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 3717fc212ad..d4dc26c48bc 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.51 2017/02/07 15:10:48 bluhm Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.52 2017/02/07 17:25:46 patrick Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -158,7 +158,7 @@ ipcomp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) ipcompstat.ipcomps_crypto++; return ENOBUFS; } - crdc = crp->crp_desc; + crdc = &crp->crp_desc[0]; crdc->crd_skip = skip + hlen; crdc->crd_len = m->m_pkthdr.len - (skip + hlen); @@ -474,7 +474,7 @@ ipcomp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, ipcompstat.ipcomps_crypto++; return ENOBUFS; } - crdc = crp->crp_desc; + crdc = &crp->crp_desc[0]; /* Compression descriptor */ crdc->crd_skip = skip; |