Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp439154pxu; Tue, 1 Dec 2020 15:27:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPf1dM/84jbPpPvmZ5G0GwizkEkvYgbJbKivydmgfc9MlQTOT7E6CQ5EQvwyOqz4wQlSrn X-Received: by 2002:aa7:c603:: with SMTP id h3mr5592219edq.254.1606865235368; Tue, 01 Dec 2020 15:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606865235; cv=none; d=google.com; s=arc-20160816; b=lNO00ESiRW3WxerhZO1KeivGhMSfrtMP1OGPvfOvGrdmgw79/JJlKUNrBjiF60aAka ICz/pGV+ujgxLb2dgwnYDEHXPG5c379/PbwHO0wb3G88D2RorgTeDuoCBSPc5/4XBL6V LNCtY6s/SGevGKrRJkSv8d4jhLAfJPlB4EvASplajvOxxDHUqeWunRlwZVdGjA/G/6wo OOuCcJ0a3EjW3SytsZBISS4Q+VZ4/wo5rLfyR/daUkjvLPQ+up9lrK+DShb7vYT3Qzf9 l8TZ/hpUTAp6Adzdiwk4EDJwv07NK5Z5VZgwgRfWFIcR55KeLMEQskx2IrVMwmbVydmp gRsg== 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=JL8z7ae5eQxXUbcTjD++B6Hm88BFJtkeOpyyktcNFAw=; b=pv0m4dq3ESUzDpXg4ZyvBaogcmnmpmylKpkpHjD39SNYX9NI9U3M58zAGYaFUULSKO g3D2irUHsssGKuGMMlpBx9afOISZDK/bkJFG3JAi/gjUhHDoiIshm1ve+3emJctRRwVm 56BuvhMU35D1m1d+f1R0Rxohm3Djk00qV0JpMDZOoCfe1z+gkmifo1KYy3zljSKQ3Y19 HG8qIziu/j/acSwp7AuiAqQjtB7gXECfXqUwRxZMfM40I6f90W3XiA+ByVMLLA94xh9e JvDCwncc8DxXvnztzd+z4L3fj1zyYfB7i8vI2s5e+C/M2ZsG/ANxx5mOuuOdgNWn9Nmg JDMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AJ18POTp; 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 mb18si999382ejb.284.2020.12.01.15.26.44; Tue, 01 Dec 2020 15:27:15 -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=AJ18POTp; 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 S1726996AbgLAXZl (ORCPT + 99 others); Tue, 1 Dec 2020 18:25:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:49670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbgLAXZl (ORCPT ); Tue, 1 Dec 2020 18:25:41 -0500 X-Gm-Message-State: AOAM531qVqv1QRDtf0lw1HVdT+vsLNaeu2g+maL3U8nAL/ovt5CkOFo3 N8Kpmln/AMwd9Ty08Nu2DGoJBe0Tvirl544jamQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606865100; bh=+twFJzadEQPpWxtqzDlpHNCdocdPt6nS4b0nAPoH0jU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AJ18POTpMTToGB7395mWThu2vPRzn4OIOJ/Ip6UpaWDSl8+VslGbyJWE/d8gOoOH1 sBjahF7Zomcxzc2yvcwd4G/bpQlcVB2/xd64BogV2kKJdBjNZEA87Yzyl3IFRHumvK Ofs6ZKfeOjTkrDBBMS3Dp0GCBsnZt/Iv8UDennaM= X-Received: by 2002:a9d:62c1:: with SMTP id z1mr3622252otk.108.1606865098855; Tue, 01 Dec 2020 15:24:58 -0800 (PST) MIME-Version: 1.0 References: <20201201194556.5220-1-ardb@kernel.org> <20201201215722.GA31941@gondor.apana.org.au> <20201201220431.GA32072@gondor.apana.org.au> <20201201221628.GA32130@gondor.apana.org.au> <20201201231158.GA32274@gondor.apana.org.au> In-Reply-To: <20201201231158.GA32274@gondor.apana.org.au> From: Ard Biesheuvel Date: Wed, 2 Dec 2020 00:24:47 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] crypto: aesni - add ccm(aes) algorithm implementation To: Herbert Xu Cc: Linux Crypto Mailing List , Ben Greear , Steve deRosier Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 2 Dec 2020 at 00:12, Herbert Xu wrote: > > On Tue, Dec 01, 2020 at 11:27:52PM +0100, Ard Biesheuvel wrote: > > > > > The problem is that the degradation would come at the worst time, > > > when the system is loaded. IOW when you get an interrupt during > > > your TX path and get RX traffic that's when you'll take the fallback > > > path. > > > > I can see how in the general case, this is something you would prefer > > to avoid. However, on SMP x86_64 systems that implement AES-NI (which > > runs at ~1 cycle per byte), I don't see this as a real problem for > > this driver. > > AES-NI is 1 cycle per byte but the fallback is not. > True. But the fallback only gets executed if the scheduler is stupid enough to schedule the TX task onto the core that is overloaded doing RX softirqs. So in the general case, both TX and RX will be using AES-NI instructions (unless the CCMP is done in hardware which is the most common case by far) > > What we could do is expose both versions, where the async version has > > a slightly higher priority, so that all users that do support the > > async interface will get it, and the wifi stack can use the sync > > interface instead. > > No we've already tried this with IPsec and it doesn't work. That's > why the async path exists in aesni. > > Wireless is no different to IPsec in this respect. > Wireless is very different. Wifi uses a medium that is fundamentally shared, and so the load it can induce is bounded. There is no way a wifi interface is going to saturate a 64-bit AES-NI core doing CCMP in software. Given the above, can't we be pragmatic here? This code addresses a niche use case, which is not affected by the general concerns regarding async crypto.