Date: Tue, 21 Oct 2014 17:23:51 GMT From: John-Mark Gurney <jmg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 1201867 for review Message-ID: <201410211723.s9LHNpPl007880@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1201867?ac=10 Change 1201867 by jmg@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410211723.s9LHNpPl007880>