PERFORCE change 1201867 for review
John-Mark Gurney
jmg at FreeBSD.org
Tue Oct 21 17:23:52 UTC 2014
http://p4web.freebsd.org/@@1201867?ac=10
Change 1201867 by jmg at jmg_carbon2 on 2014/10/21 17:22:57
add the same optimizations to mbufs that is in iovecs... If
there is only one mbuf in the chain, use it directly... This
should significantly help IPsec performance, especially with
small packets...
change some casts to properly match types...
Sponsored by: FreeBSD Foundation
Sponsored by: Netgate
Idea by: eri
Affected files ...
.. //depot/projects/opencrypto/sys/crypto/aesni/aesni.c#11 edit
Differences ...
==== //depot/projects/opencrypto/sys/crypto/aesni/aesni.c#11 (text+ko) ====
@@ -369,20 +369,24 @@
aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp,
int *allocated)
{
+ struct mbuf *m;
struct uio *uio;
struct iovec *iov;
uint8_t *addr;
- if (crp->crp_flags & CRYPTO_F_IMBUF)
- goto alloc;
- else if (crp->crp_flags & CRYPTO_F_IOV) {
+ if (crp->crp_flags & CRYPTO_F_IMBUF) {
+ m = (struct mbuf *)crp->crp_buf;
+ if (m->m_next != NULL)
+ goto alloc;
+ addr = mtod(m, uint8_t);
+ } else if (crp->crp_flags & CRYPTO_F_IOV) {
uio = (struct uio *)crp->crp_buf;
if (uio->uio_iovcnt != 1)
goto alloc;
iov = uio->uio_iov;
- addr = (u_char *)iov->iov_base + enccrd->crd_skip;
+ addr = (uint8_t *)iov->iov_base + enccrd->crd_skip;
} else
- addr = (u_char *)crp->crp_buf;
+ addr = (uint8_t *)crp->crp_buf;
*allocated = 0;
return (addr);
More information about the p4-projects
mailing list