Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp134579pxu; Wed, 25 Nov 2020 15:24:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJynCzacT7BuDk3r/r+Kq6MQrb+wGHuDWXxFk9ybM9erIU3sZPsRbMfkXdbjh0djpeuYZgYf X-Received: by 2002:a05:6402:1c04:: with SMTP id ck4mr38672edb.320.1606346654979; Wed, 25 Nov 2020 15:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606346654; cv=none; d=google.com; s=arc-20160816; b=RIrgoXMok23RY430LdNHhIRV4uxG3kEgpBzczZswKAYc2Jho7Z9mL4jB0WpGK/Fxnm acBNlJAUnI46GQMtKiY23wN4po9+SEmr/nUb3lohhTw6gt4buH08+KkeprHV8hzxqMt8 wcbMWRtHbW9topku0A2+U54ZesmY3JMaJfwUvnFmB2/bl54JEIJ0S25j2yHP7sTxcCkn Gd0cntB6jNHej50R3henVsdvOC5SUnQhIl39jBxc3ZvXBpE611kh13olEPLLllNZYhaL 8b1b2X59WY6V4Cyr3a5EMB4KoX2hJ0RCTk5XNfe1i3Yq6GM4TxTvf8UZj41A4Xr3xdhL wxqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pwKAuGJSvOlwl9lKlDq9LSp/EYuh1D1hiZb8vpBR8AI=; b=lIo0xHZMtz4E/AxHtzvCyVaiHs9MU52zQLKAdnlop31vAA5WWcsE9ZRlZ3inLYGNi2 d3wo1iT6gu9MKxBInImFVH3UVp8GqKGW9tm5NtkcclKtr42mQlCpBd1LUsUREh0WSY70 jhiOzioC1cgw3lfSFid7SjBNYe8dyKAr/xriQCiVKI1Ap+RYkYxt0rilwe2pcy3kJnN2 OUIxHB021XTDghnPBhgexE69V8tVwsay6qq8AbUHcASSGFVZH2USvWbLnHX6VOBOjBPl h39lbeWez7oEmNUNNKt00dYDOGY9AcCJNewM7rOaES9pXsG25Hvld/KZwMI6TNqp8BF6 gXfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZRRjETqA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si2102938ejm.412.2020.11.25.15.23.51; Wed, 25 Nov 2020 15:24:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZRRjETqA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731846AbgKYVRL (ORCPT + 99 others); Wed, 25 Nov 2020 16:17:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:51674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731796AbgKYVRK (ORCPT ); Wed, 25 Nov 2020 16:17:10 -0500 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8BA52083E; Wed, 25 Nov 2020 21:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606339029; bh=58337+gs43iP+cFDxloCX/PrwkDLWOuPYltM2JNApwc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZRRjETqAJR47pcyuqxnSuqvNCs2wh1ZDuFvp/uMjJ3UwnmfsbDC9VPx89WbkUJww2 s+YUXJIPU+174mRAbEaDi1XKTP0HLR4Ufb8M6bUubvE7J6ZuYK+ia31bmXh/qaJoAI kq0inx9G5xv318ShlNc2SGMBB/YSgZSyLvlhf5oo= Received: by mail-oi1-f169.google.com with SMTP id f11so4405165oij.6; Wed, 25 Nov 2020 13:17:09 -0800 (PST) X-Gm-Message-State: AOAM532zmpcekmyJl5dIvnolhIoqB41KiQfx8opLUkpX9gj5LHdI42DQ AdZjcScgGNQHqvIpYn/23IRB4GFd1yqjpDy7qdM= X-Received: by 2002:aca:c657:: with SMTP id w84mr5748oif.47.1606339029021; Wed, 25 Nov 2020 13:17:09 -0800 (PST) MIME-Version: 1.0 References: <20201125211311.2179-1-iuliana.prodan@oss.nxp.com> In-Reply-To: <20201125211311.2179-1-iuliana.prodan@oss.nxp.com> From: Ard Biesheuvel Date: Wed, 25 Nov 2020 22:16:57 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 0/4] crypto: add CRYPTO_TFM_REQ_DMA flag To: "Iuliana Prodan (OSS)" Cc: Herbert Xu , Ard Biesheuvel , "David S. Miller" , Horia Geanta , Aymen Sghaier , Silvano Di Ninno , Franck Lenormand , Linux Crypto Mailing List , Linux Kernel Mailing List , linux-imx , Iuliana Prodan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 25 Nov 2020 at 22:14, Iuliana Prodan (OSS) wrote: > > From: Iuliana Prodan > > Add the option to allocate the crypto request object plus any extra space > needed by the driver into a DMA-able memory. > > Add CRYPTO_TFM_REQ_DMA flag to be used by backend implementations to > indicate to crypto API the need to allocate GFP_DMA memory > for private contexts of the crypto requests. > These are always directional DMA mappings, right? So why can't we use bounce buffering here? > For IPsec use cases, CRYPTO_TFM_REQ_DMA flag is also checked in > esp_alloc_tmp() function for IPv4 and IPv6. > > This series includes an example of how a driver can use > CRYPTO_TFM_REQ_DMA flag while setting reqsize to a larger value > to avoid allocating memory at crypto request runtime. > The extra size needed by the driver is added to the reqsize field > that indicates how much memory could be needed per request. > > Iuliana Prodan (4): > crypto: add CRYPTO_TFM_REQ_DMA flag > net: esp: check CRYPTO_TFM_REQ_DMA flag when allocating crypto request > crypto: caam - avoid allocating memory at crypto request runtime for > skcipher > crypto: caam - avoid allocating memory at crypto request runtime for > aead > > drivers/crypto/caam/caamalg.c | 130 +++++++++++++++++++++++++--------- > include/crypto/aead.h | 4 ++ > include/crypto/akcipher.h | 21 ++++++ > include/crypto/hash.h | 4 ++ > include/crypto/skcipher.h | 4 ++ > include/linux/crypto.h | 1 + > net/ipv4/esp4.c | 7 +- > net/ipv6/esp6.c | 7 +- > 8 files changed, 144 insertions(+), 34 deletions(-) > > -- > 2.17.1 >