Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2936452ybn; Thu, 26 Sep 2019 21:14:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9jClB7b9V/P7OfHbtr/oiZFpCAmBqkLVMSlpUdtCMaxG+9aXsBx1GJzuX+BAAb8NSAo1b X-Received: by 2002:a50:f616:: with SMTP id c22mr2284436edn.235.1569557641753; Thu, 26 Sep 2019 21:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569557641; cv=none; d=google.com; s=arc-20160816; b=COO2/xvjHwcBqQdqK0C30aCoM90HpXEah2DPT6jImwcOr9ZcmfAqxAlLPTSNHJCos5 DWbgpQycQ+b/VbA52YIkjCXqVgrcWxoe844PO8cMbnzzQbOsMUogRRFg3v5NsYSMTn7M B8zM0zEgwQkiXHJlsvk4vGx3xL4oojAht1WWZwmm25oP++iQ2bb4aXR7DP+ZGayrM7B6 SCDiJgpnaMQcHEKH+yn2w0xuqWhaKHgdqAjG2Nnn5fq4LZbVOXnkkXpic0Dv/XVAD+aP mTLc1jzZM0jj9cLm8z/KGpd6RlGcgJRajpxD637xBtn8cu+/BMwQSmXIzRAIQVEOteI1 ODlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5UH138tG9PRYMsFiBULF307JYuT/lrT57+qHytLZwTU=; b=hQriU7HTeaREOiHep68ev1PUiNq8idtCgB35ocCBzUNEdCgL0WCEu8N96iWuAPN8/W 00tDzpaCFLWIVAtlxci1bjtKFWvoGag4a1Be/BHgoBNPrdDAKLVw36os9pAlGX+dVBU/ eg1UM2/BI6tr6hEu7kfJ12lYikrF7WLpxPBf+gZW+t4x65DdyWm4D4WKNCIjnVLHzfQb uD/jDntfFiLqAsKPxC2r08G6A+rMlB1PIZ6O7H+FGNAbulr8/AncZj1yFxaG1GTNjipH E+54b//HLZKbRM258gQ0zunDtaXbFmXNGBtSzYhZMd7DNNoh1HFCf8ci+ybr94eejEbP JGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=bBr8IhrV; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x45si772344edd.388.2019.09.26.21.13.31; Thu, 26 Sep 2019 21:14:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=bBr8IhrV; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726272AbfI0EN1 (ORCPT + 99 others); Fri, 27 Sep 2019 00:13:27 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39820 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfI0EN0 (ORCPT ); Fri, 27 Sep 2019 00:13:26 -0400 Received: by mail-lj1-f193.google.com with SMTP id y3so1081204ljj.6 for ; Thu, 26 Sep 2019 21:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5UH138tG9PRYMsFiBULF307JYuT/lrT57+qHytLZwTU=; b=bBr8IhrV4sosw8kqW0dHsTq9GgR0+dGbb+WZnt90hJKIYvZIVl9uJsc+OuNBXNvjes O6N01AGJP1KsO+TyFpDEMT2T7EIMNKn4xgTgO+MVoe6U95I8Y9c+kh8bIUmhNNK5h9JR exqx/qee3opyNYZGxe07JPuXx9b8lC0gZSeiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5UH138tG9PRYMsFiBULF307JYuT/lrT57+qHytLZwTU=; b=c0cQ4Yf7LrN3x/w8EApnJNR2VNk78hjacQkdJAksq/kp5sJUPD+S6NykLKVZ827Yvl +XqieKHpj6XtOCQ77nmAvAQVWzOsVlCvXC+yisgYSMTyfCDFB5RbiMX3iDKoHnRxvNa2 L+rzwlRLVaj8Cxd0S/ohhg7XZSym9o+6DU+nuWeewOn6V1ZLnd3X7+RhaG34b6/jTJAQ ZwY0eCg9L4RkLZC6jdOiwNu/mkppp9jxoAlNNlQbjz0ea1Dr63lLU1aFHBX4Ol4CAHF9 KHn1cFmR3sU0qm3i94Od/v82Fcw6mpRKlSMZjYpf+F4CI6lI/XMQBAIRJrLiRyaXBRVD yt4w== X-Gm-Message-State: APjAAAXyXpI88jWy1rkskrdqTbrvrLnAa/VJahGWa00sos6NXAhIp2+X 3RoX4WODq1J/ULdo/nh3oAHr1kH/aBE= X-Received: by 2002:a2e:9d4a:: with SMTP id y10mr1218665ljj.181.1569557604801; Thu, 26 Sep 2019 21:13:24 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id i128sm219371lji.49.2019.09.26.21.13.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2019 21:13:24 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id q11so808262lfc.11 for ; Thu, 26 Sep 2019 21:13:23 -0700 (PDT) X-Received: by 2002:ac2:5c11:: with SMTP id r17mr1187992lfp.61.1569557603654; Thu, 26 Sep 2019 21:13:23 -0700 (PDT) MIME-Version: 1.0 References: <20190925161255.1871-1-ard.biesheuvel@linaro.org> <20190925161255.1871-19-ard.biesheuvel@linaro.org> <20190927040140.GA24370@gondor.apana.org.au> In-Reply-To: <20190927040140.GA24370@gondor.apana.org.au> From: Linus Torvalds Date: Thu, 26 Sep 2019 21:13:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 18/18] net: wireguard - switch to crypto API for packet encryption To: Herbert Xu Cc: Pascal Van Leeuwen , Ard Biesheuvel , Linux Crypto Mailing List , Linux ARM , David Miller , Greg KH , "Jason A . Donenfeld" , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Will Deacon , Marc Zyngier , Catalin Marinas Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Sep 26, 2019 at 9:01 PM Herbert Xu wrote: > > So there is really no async overhead in the crypto API AFAICS if > you're always doing sync. What you see as overheads are probably > the result of having to support multiple underlying algorithms > (not just accelerations which can indeed be handled without > indirection at least for CPU-based ones). Fair enough, and sounds good. The biggest overhead is that indirection for the state data, and the fact that the code indirect calls the actual function. If that could be avoided by just statically saying crypto_xyz_encrypt() (with the xyz being the crypto algorithm you want) and having the state be explicit, then yes, that would remove most of the overhead. It would still leave setting the callback fields etc that are unnecessary for the synchronous case and that I think could be done differently, but that's probably just a couple of stores, so not particularly noticeable. Linus