From owner-p4-projects@FreeBSD.ORG Tue Oct 21 17:23:52 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 703CFF25; Tue, 21 Oct 2014 17:23:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 323EDF23 for ; Tue, 21 Oct 2014 17:23:52 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E6A3BE2 for ; Tue, 21 Oct 2014 17:23:52 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHNpJn007883 for ; Tue, 21 Oct 2014 17:23:51 GMT (envelope-from jmg@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.9/8.14.9/Submit) id s9LHNpPl007880 for perforce@freebsd.org; Tue, 21 Oct 2014 17:23:51 GMT (envelope-from jmg@freebsd.org) Date: Tue, 21 Oct 2014 17:23:51 GMT Message-Id: <201410211723.s9LHNpPl007880@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jmg@freebsd.org using -f From: John-Mark Gurney Subject: PERFORCE change 1201867 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.18-1 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:23:52 -0000 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);