From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86EEDC282D7 for ; Wed, 30 Jan 2019 23:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B87A218AF for ; Wed, 30 Jan 2019 23:08:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="TAS62E7l"; dkim=pass (1024-bit key) header.d=fb.onmicrosoft.com header.i=@fb.onmicrosoft.com header.b="Kf2a4DWv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728843AbfA3XIl (ORCPT ); Wed, 30 Jan 2019 18:08:41 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:50110 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfA3XIk (ORCPT ); Wed, 30 Jan 2019 18:08:40 -0500 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0ULu1WB008175; Wed, 30 Jan 2019 14:09:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=gwnt7L+Bxx5SO5DwzbJMIgFQUE0oqr3LDImrQ3VmjwQ=; b=TAS62E7l/FogFsCkm1Rp6b06Edslo/bpOngezEd+gBW5HlKMtkQLmqBwKpJQlPhiS9t7 L34iJxJWJrEtitQZYJLvPrBAfCmuE3EHj8kZUdn/+nUgLEW7BKSaSfjGFX6bSk3z98Yl sBkZC/43o1Ovo6J3+IBCO9Hvj64miw8SUsE= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2qbjcy8e6m-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 30 Jan 2019 14:09:15 -0800 Received: from prn-hub04.TheFacebook.com (2620:10d:c081:35::128) by prn-hub01.TheFacebook.com (2620:10d:c081:35::125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3; Wed, 30 Jan 2019 14:08:22 -0800 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3 via Frontend Transport; Wed, 30 Jan 2019 14:08:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gwnt7L+Bxx5SO5DwzbJMIgFQUE0oqr3LDImrQ3VmjwQ=; b=Kf2a4DWv8Ny/Jt9rp93WtC/50skCwc+ycTeZAOkij8V84IFYaEkEWKvebgZABOe1tAsQFgON/TnAQy8Z111QbeLe6rjvaq3YUYFaZ9bZkFH/kuXA9MtiVqEuephfUBOzbwF6ANG4Gw18jdi9y86dagPV17zis+A7KDCkaRegRbM= Received: from MWHPR15MB1134.namprd15.prod.outlook.com (10.175.2.12) by MWHPR15MB1615.namprd15.prod.outlook.com (10.175.135.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.21; Wed, 30 Jan 2019 22:08:21 +0000 Received: from MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::93f:b6fe:a6e9:80dc]) by MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::93f:b6fe:a6e9:80dc%8]) with mapi id 15.20.1580.017; Wed, 30 Jan 2019 22:08:21 +0000 From: Dave Watson To: "netdev@vger.kernel.org" , Dave Miller CC: Vakul Garg , Boris Pismenny , Aviad Yehezkel , John Fastabend , Daniel Borkmann Subject: [PATCH net-next] net: tls: Set async_capable for tls zerocopy only if we see EINPROGRESS Thread-Topic: [PATCH net-next] net: tls: Set async_capable for tls zerocopy only if we see EINPROGRESS Thread-Index: AQHUuOhPut/N8HRVAUGBnjULweC8pQ== Date: Wed, 30 Jan 2019 22:08:21 +0000 Message-ID: <20190130220819.wgwenjanlzftvb6i@davejwatson-mba.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: NeoMutt/20180716 x-clientproxiedby: MWHPR17CA0094.namprd17.prod.outlook.com (2603:10b6:300:c2::32) To MWHPR15MB1134.namprd15.prod.outlook.com (2603:10b6:320:22::12) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:180::1:7423] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR15MB1615;20:Ghai+fQLRkUXe97z4S76fB18tU58IB98JGCrWPoSPSZ82Y1xlooH35aNt/IbKN01Rw9iW3t5C4MNfC1bnaXoAKPLXCQjawPCpfy1UX+plx9daXbCA8O/q7nJiL7HqG7NpRM4QEEvecDN9firslcUHQRl3j2uNNyr818f5jeXLVQ= x-ms-office365-filtering-correlation-id: a956b5dc-81af-4888-ccad-08d686ff723c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1615; x-ms-traffictypediagnostic: MWHPR15MB1615: x-microsoft-antispam-prvs: x-forefront-prvs: 0933E9FD8D x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(376002)(136003)(396003)(39860400002)(189003)(199004)(4326008)(97736004)(9686003)(2906002)(68736007)(106356001)(52116002)(14454004)(53936002)(33896004)(25786009)(81166006)(6506007)(386003)(102836004)(105586002)(186003)(476003)(46003)(486006)(6116002)(81156014)(6486002)(14444005)(256004)(39060400002)(8676002)(6436002)(1076003)(6512007)(71190400001)(98436002)(478600001)(8936002)(110136005)(305945005)(54906003)(316002)(58126008)(99286004)(7736002)(2501003)(71200400001)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1615;H:MWHPR15MB1134.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: rLKPWArPvH9E8b6NZ5NF5BKeyyHiOTntTF7XYJozWBJoAjH4LvH9dwqHVRv/kwJ5TB3PFT6NDc7z+lMi0lZeD3COhRHhDrD96SSP5BjQuwXeI24G1smyU9e4pLi14igo3s3bFoeR+bmUTjCY1D+u8ZdC3J4B7uC9vakob6owhtU+pWc09jYrpsT4/5nXKb13yyKCiYh1iEQ0mFAwlwyCAPyxXBnJevFDWZ2r2Mlqc/7BK5H2J9mR0dRPyhhTBDNjgoYIMqCseocM0UsplQrGaW9MleI5bym4pbcg2jKFu1ot+wioQh+5wBdKcj+iognabvSCPqQmzOfrXUtoLQTCOnLIEDsnN3hOOcHPS/2I36CSNpP+BpSqKcJrPV7+y/s+YhOLxtOOafSrqIzSk7PGqYihalwN5sqiQWbXn0dkFXE= Content-Type: text/plain; charset="us-ascii" Content-ID: <2B887D54AA8F064599DDF924C8A19C31@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a956b5dc-81af-4888-ccad-08d686ff723c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2019 22:08:21.0112 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1615 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-30_16:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently we don't zerocopy if the crypto framework async bit is set. However some crypto algorithms (such as x86 AESNI) support async, but in the context of sendmsg, will never run asynchronously. Instead, check for actual EINPROGRESS return code before assuming algorithm is async. Signed-off-by: Dave Watson --- include/net/tls.h | 1 + net/tls/tls_sw.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/net/tls.h b/include/net/tls.h index 4592606e136a..eb73e62ac8c9 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -139,6 +139,7 @@ struct tls_sw_context_tx { struct list_head tx_list; atomic_t encrypt_pending; int async_notify; + int async_capable; =20 #define BIT_TX_SCHEDULED 0 unsigned long tx_bitmask; diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 3f2a6af27e62..2864ad16c2d9 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -673,6 +673,7 @@ static int tls_push_record(struct sock *sk, int flags, tls_merge_open_record(sk, rec, tmp, orig_end); } } + ctx->async_capable =3D 1; return rc; } else if (split) { msg_pl =3D &tmp->msg_plaintext; @@ -814,8 +815,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg,= size_t size) long timeo =3D sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); struct tls_context *tls_ctx =3D tls_get_ctx(sk); struct tls_sw_context_tx *ctx =3D tls_sw_ctx_tx(tls_ctx); - struct crypto_tfm *tfm =3D crypto_aead_tfm(ctx->aead_send); - bool async_capable =3D tfm->__crt_alg->cra_flags & CRYPTO_ALG_ASYNC; + bool async_capable =3D ctx->async_capable; unsigned char record_type =3D TLS_RECORD_TYPE_DATA; bool is_kvec =3D iov_iter_is_kvec(&msg->msg_iter); bool eor =3D !(msg->msg_flags & MSG_MORE); --=20 2.17.1