From owner-freebsd-current@freebsd.org Thu Mar 11 00:18:38 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1634F57BD20 for ; Thu, 11 Mar 2021 00:18:38 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DwqL46Vl4z4tZw for ; Thu, 11 Mar 2021 00:18:36 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f170.google.com with SMTP id t83so11260413oih.12 for ; Wed, 10 Mar 2021 16:18:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=o/zLsiCk2zKmrPoN7L8FTy1qKAT9/vDem/JoAMvTOEk=; b=rmI2z9RcNlKNkbV0Hr5lFHsUlvdlTJZFmttEneUYQmTAqmuvaXg61bADWCT7m3tVOF eEUA67tuD7z146S54PsXJ1dy5bQpkTAjnth3D1olJ+ovoCBdSxVYV5MmY8QTon5xmHB5 Aqkj2RJAXf4cluB5nodWI+rKCiLhsj0m38mRMkAecXi0XRQ6SsTw7cVWlHnQTW0HjOmp +if92ukdlqryX5QpPWSN0APFC61uNzcy/UqMqeH5iRsb/wkpFUJz5LBht+Bvm3ik+Zz5 o2v9dUDILJzn1WaRxGTzNUx+3jrBp90PFxS4o/YY+VfZMkRsREzZqTutGVolSSPnujOf 58aw== X-Gm-Message-State: AOAM531w8TPSQL76ga/16hQksU+NOpzf2vaxEbEMzye0n0B3J2rkHBES MLI/3/DfAb+0EEuppjGME4rDGnbcMUgbpEmSgsj+cJ09t4lrdA== X-Google-Smtp-Source: ABdhPJykoNAbExBMjys+CB2yS19QEWfowVEyDwaH/iFSKof1N9TUEZzRlwUlRmKj6rmSLna3cwhbTawtnJEWm60ZuRs= X-Received: by 2002:aca:4f0b:: with SMTP id d11mr4390050oib.73.1615421915186; Wed, 10 Mar 2021 16:18:35 -0800 (PST) MIME-Version: 1.0 From: Alan Somers Date: Wed, 10 Mar 2021 17:18:24 -0700 Message-ID: Subject: Getting started with ktls To: FreeBSD CURRENT X-Rspamd-Queue-Id: 4DwqL46Vl4z4tZw X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.170 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.999]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.167.170:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_DOM_EQ_FROM_DOM(0.00)[]; FREEFALL_USER(0.00)[asomers]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[209.85.167.170:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.170:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.170:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-current] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 00:18:38 -0000 I'm trying to make ktls work with "zfs send/recv" to substantially reduce the CPU utilization of applications like zrepl. But I have a few questions: * ktls(4)'s "Transmit" section says "Once TLS transmit is enabled by a successful set of the TCP_TXTLS_ENABLE socket option", but the "Supported Libraries" section says "Applications using a supported library should generally work with ktls without any changes". These sentences seem to be contradictory. I think it means that the TCP_TXTLS_ENABLE option is necessary, but OpenSSL sets it automatically? * When using OpenSSL, the library will automatically call setsockopt(_, TCP_TXTLS_ENABLE). But it swallows the error, if any. How is an application to tell if ktls is enabled on a particular socket or OpenSSL session? * From experiment, I can see that OpenSSL attempts to set TCP_TXTLS_ENABLE. But it doesn't try to set TCP_RXTLS_ENABLE. Why not? >From reading ktls_start and ossl_statem_server_post_work, it looks like maybe a single socket cannot have ktls enabled for both sending and receiving at the same time. Is that true? Based on the man page and rmacklem's previous mailing list posts, I think this should be workable with minor modifications to the kernel and libzfs. I just need to figure out how to use ktls first. -Alan