Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1949027ybn; Thu, 26 Sep 2019 04:49:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYq1FY+LS3BmcUy+e4KxSKLI8QypzxR/DRU4s9bq42ANP0ibgzpB3R1sRy+bGt/Lq2qY2q X-Received: by 2002:a50:ac0a:: with SMTP id v10mr3068291edc.83.1569498555165; Thu, 26 Sep 2019 04:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569498555; cv=none; d=google.com; s=arc-20160816; b=KRwcjHzaazsiFPNEmAHGjAbmwK/Szi3wiqFIGBWPlgRQHTPnekcZ4aL9T9C88eJXr2 JSYyhPs7AoFWiZruqZlu0R8SEjLhG6EXMj4hc/6lhzbWjTwDpqmuqVmVlBY6KDCDoNju Et0QFKp4Ngzf5bDLjyBuqOnLK0qCSqo+W+h2sX/sc95j3Rxr7Mx4/qlhpHhaMIMk/3Ou r+zrwXCa/04s2tj5BpnP4gfPBL/1hl5veLu4MsgePSH8lwEohRHDpzwewN7jzE6m5AcJ 0gUY1IcnUUOBopQ07LhPqQieSeIUcLHqPgMpjvMJ1Lc/+bmaj4HGQgY2wIqlr/t5/cw+ jG7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:from; bh=2ozAWmHQqzsPDD0WmdG2auChc9T1w49xSlDI6ZfDT7o=; b=nCUQANV/YPnBB05a0d06Sw8G7QNJcC7eY1KRhBpTcpFSK8kTNIOz2xxz/GTS3LjcjZ nED+SvX0UXhZbg7EeZ1Z0bI36LMHqSbWy0ohjqCdWEuKcCtnMie36vMZCLSEJygvbM61 4M4QDwZYF2+T0aNI3crfy73euPxP6bREWGba42EOibWPo0glHtGXSUkANDaAw4jsS1Bc 9uncEfMuA1FOkp2l0ixm+5oJ/y23UJ+L2ERvORFBWgdJSSkzYVBAoGH9mWSZWCOQ4WvO juPTXUhXDj3EV+zOirv3uGWUQ2/uHEZ2AYrJkJNC6xY34njwsHe7nEUnf6pwGIdtyRd5 aRBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b="E7B4xf/s"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si1122580edd.269.2019.09.26.04.48.43; Thu, 26 Sep 2019 04:49:15 -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=@toke.dk header.s=20161023 header.b="E7B4xf/s"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbfIZLsj (ORCPT + 99 others); Thu, 26 Sep 2019 07:48:39 -0400 Received: from mail.toke.dk ([52.28.52.200]:56781 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbfIZLsj (ORCPT ); Thu, 26 Sep 2019 07:48:39 -0400 X-Greylist: delayed 598 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Sep 2019 07:48:38 EDT From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1569497917; bh=2ozAWmHQqzsPDD0WmdG2auChc9T1w49xSlDI6ZfDT7o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=E7B4xf/sxTyXBeJoIGW4nq+Nma+qA/w0+mvTe4vhnAMnXOMwoNqN3gDE5hVdmdNzh /cy8vHjKBAT2ogyoiI6miZ76hx67WQMVHN6a2BVqXmNEVEsuXo+5o7swBUAPCBWqHv VMmzaEdMsV2Uv19vqCGkyzwg2EJEb01nOVmOnVhCTdWd4ObjWDaCmz3mtvmwvX1xkx N27rxXs/S8RzJjikh/vluQgPD3Jx6octJQQJEEF38ED/mcB5ByakvsgPj4OAYlok2R So9Nhhgnw01AwyOqMWr8VQnGQ5pUR3ZKQGpfV25KDOG2KIbUNkX5Z+F9X+p9L2Xo7C n9nJBQm/HWwGw== To: "Jason A. Donenfeld" , Pascal Van Leeuwen Cc: Ard Biesheuvel , Linux Crypto Mailing List , linux-arm-kernel , Herbert Xu , David Miller , Greg KH , Linus Torvalds , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Will Deacon , Marc Zyngier , Catalin Marinas , Willy Tarreau , Netdev , Dave Taht Subject: Re: chapoly acceleration hardware [Was: Re: [RFC PATCH 00/18] crypto: wireguard using the existing crypto API] In-Reply-To: References: <20190925161255.1871-1-ard.biesheuvel@linaro.org> Date: Thu, 26 Sep 2019 13:38:36 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <8736gj2soz.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org "Jason A. Donenfeld" writes: > [CC +willy, toke, dave, netdev] > > Hi Pascal > > On Thu, Sep 26, 2019 at 12:19 PM Pascal Van Leeuwen > wrote: >> Actually, that assumption is factually wrong. I don't know if anything >> is *publicly* available, but I can assure you the silicon is running in >> labs already. And something will be publicly available early next year >> at the latest. Which could nicely coincide with having Wireguard support >> in the kernel (which I would also like to see happen BTW) ... >> >> Not "at some point". It will. Very soon. Maybe not in consumer or server >> CPUs, but definitely in the embedded (networking) space. >> And it *will* be much faster than the embedded CPU next to it, so it will >> be worth using it for something like bulk packet encryption. > > Super! I was wondering if you could speak a bit more about the > interface. My biggest questions surround latency. Will it be > synchronous or asynchronous? If the latter, why? What will its > latencies be? How deep will its buffers be? The reason I ask is that a > lot of crypto acceleration hardware of the past has been fast and > having very deep buffers, but at great expense of latency. In the > networking context, keeping latency low is pretty important. Already > WireGuard is multi-threaded which isn't super great all the time for > latency (improvements are a work in progress). If you're involved with > the design of the hardware, perhaps this is something you can help > ensure winds up working well? For example, AES-NI is straightforward > and good, but Intel can do that because they are the CPU. It sounds > like your silicon will be adjacent. How do you envision this working > in a low latency environment? Being asynchronous doesn't *necessarily* have to hurt latency; you just need the right queue back-pressure. We already have multiple queues in the stack. With an async crypto engine we would go from something like: stack -> [qdisc] -> wg if -> [wireguard buffer] -> netdev driver -> device -> [device buffer] -> wire to stack -> [qdisc] -> wg if -> [wireguard buffer] -> crypto stack -> crypto device -> [crypto device buffer] -> wg post-crypto -> netdev driver -> device -> [device buffer] -> wire (where everything in [] is a packet queue). The wireguard buffer is the source of the latency you're alluding to above (the comment about multi-threaded behaviour), so we probably need to fix that anyway. For the device buffer we have BQL to keep it at a minimum. So that leaves the buffering in the crypto offload device. If we add something like BQL to the crypto offload drivers, we could conceivably avoid having that add a significant amount of latency. In fact, doing so may benefit other users of crypto offloads as well, no? Presumably ipsec has this same issue? Caveat: I am fairly ignorant about the inner workings of the crypto subsystem, so please excuse any inaccuracies in the above; the diagrams are solely for illustrative purposes... :) -Toke