From patchwork Wed Jun 7 18:19:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13271093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D32AFC7EE23 for ; Wed, 7 Jun 2023 18:20:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7963C8E0001; Wed, 7 Jun 2023 14:20:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71F39900004; Wed, 7 Jun 2023 14:20:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57012900007; Wed, 7 Jun 2023 14:20:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 467EA900004 for ; Wed, 7 Jun 2023 14:20:17 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2180580354 for ; Wed, 7 Jun 2023 18:20:17 +0000 (UTC) X-FDA: 80876766474.12.6B87C5E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 7328240008 for ; Wed, 7 Jun 2023 18:20:15 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gqR5U08G; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686162015; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=axbQ2fmWT7oadEpv+RKPywBYD27/saJPi8A/5AZqeFc=; b=IQz/OHPlOzamw/2T3RLaxRXeCKXWbgCgkLrd27tAzn4AdVtqvUAlBOAsREUBWq/hIUUCfp yV8qF6CdXZCGfkoJb7WQjL4TrDjOrs0ybXUQXl5sUvrG0ezoFSysJEt8BsnFikt3UY6ayl efULSRyWQWcSmanjjIkICSEcprC24is= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686162015; a=rsa-sha256; cv=none; b=JXXJzr7hr8w4kMfTOv9Ol1S7ZUE+Y2ZqCTkRBP2oO18igmTqeP8tKCtuynjrlZq5EiUVXh DMaX9PBQvmR/RWP2Kx81yOaI8J7F6kHIMpcYKsr5NHBTq29J8p3JWPimr9BOgjDaFdV33s bE16pwfdQSfLc1XWqrYOjmfs9ft1cNM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gqR5U08G; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686162014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=axbQ2fmWT7oadEpv+RKPywBYD27/saJPi8A/5AZqeFc=; b=gqR5U08Gcm756+2sKWslptqLrAHrRF1cnTudLTB7NQi5Uk/cqxxWBe+qa8SF3lzheXrndQ frjoOwEIv4Ld6En5QXR3H+2GBkFKZyACnrQCLTPDor2pWB/68EYItEkAOVFi5lVjZlcXs1 XsqbCHVD4HHoGZg2Hic6G1fHYHF+sIc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-296-TW2Be_pnM5qS_UH9e9Xw1g-1; Wed, 07 Jun 2023 14:20:11 -0400 X-MC-Unique: TW2Be_pnM5qS_UH9e9Xw1g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A99C80331C; Wed, 7 Jun 2023 18:20:10 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D78C2026D49; Wed, 7 Jun 2023 18:20:07 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org, Linus Torvalds Cc: David Howells , Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ayush Sawal Subject: [PATCH net-next v6 08/14] chelsio/chtls: Use splice_eof() to flush Date: Wed, 7 Jun 2023 19:19:14 +0100 Message-ID: <20230607181920.2294972-9-dhowells@redhat.com> In-Reply-To: <20230607181920.2294972-1-dhowells@redhat.com> References: <20230607181920.2294972-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 7328240008 X-Rspam-User: X-Stat-Signature: sdqntc8iwcydmsz7xh9wd5mwfrybtwjy X-Rspamd-Server: rspam03 X-HE-Tag: 1686162015-478572 X-HE-Meta: U2FsdGVkX18NPEXnK7l30Ua/VRb7n0FOz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xKkq0Ayy3f/pAhyvVdy2j42EY7BMkR1MYl/sUb7qir820QNFIrOTNt6JpOkf8uejl2HP7JCSpyeqNl4VkT1Pw1UYpi0SawvdcRIPq0iE1f10Ws9yFOjW7aLuFyy1saGfJdEknBr8HbSba2FcxcBHig+Lnsd4FiMAwgfiY20LIF+PJh8ZqBv6HtMGmV/pEHBqGvLSeUNzTxmP/ZbqdNA244H4d2z3VJyBUxi1gXjZhbHcNdEIBBt/TDr+qv57NTmenIvdPGZ683b5cw1iOZpc/TI15JDsxyAK5Ll3PeV/LjPLd9X/Bff485Pc6Krf0e6pb4Cxn9eDZZWFtPmY1BpL7cmCVn56yENlFUSCG/dc6WTmZgY9uZ5oMxJw+9Ueus8i0aeeWotrOe9XBVBevkLTF5IIA43zyoC5cC2Qs5O2tQObJdQ+VDG9e4S2GJmZdU7rqOEB4ncEdafPjDm1wKqeLqNj/L1u5hWHUNwZIRFwrsjUDwzF0lOjRjW5MLWp4hLha0fet/DtD+o+5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Allow splice to end a Chelsio TLS record after prematurely ending a splice/sendfile due to getting an EOF condition (->splice_read() returned 0) after splice had called sendmsg() with MSG_MORE set when the user didn't set MSG_MORE. Suggested-by: Linus Torvalds Link: https://lore.kernel.org/r/CAHk-=wh=V579PDYvkpnTobCLGczbgxpMgGmmhqiTyE34Cpi5Gg@mail.gmail.com/ Signed-off-by: David Howells cc: Ayush Sawal cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h | 1 + .../net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c | 9 +++++++++ .../ethernet/chelsio/inline_crypto/chtls/chtls_main.c | 1 + 3 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h index 41714203ace8..da4818d2c856 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h @@ -568,6 +568,7 @@ void chtls_destroy_sock(struct sock *sk); int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); int chtls_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags, int *addr_len); +void chtls_splice_eof(struct socket *sock); int chtls_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags); int send_tx_flowc_wr(struct sock *sk, int compl, diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c index 5724bbbb6ee0..e08ac960c967 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c @@ -1237,6 +1237,15 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) goto done; } +void chtls_splice_eof(struct socket *sock) +{ + struct sock *sk = sock->sk; + + lock_sock(sk); + chtls_tcp_push(sk, 0); + release_sock(sk); +} + int chtls_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags) { diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c index 1e55b12fee51..6b6787eafd2f 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c @@ -606,6 +606,7 @@ static void __init chtls_init_ulp_ops(void) chtls_cpl_prot.destroy = chtls_destroy_sock; chtls_cpl_prot.shutdown = chtls_shutdown; chtls_cpl_prot.sendmsg = chtls_sendmsg; + chtls_cpl_prot.splice_eof = chtls_splice_eof; chtls_cpl_prot.sendpage = chtls_sendpage; chtls_cpl_prot.recvmsg = chtls_recvmsg; chtls_cpl_prot.setsockopt = chtls_setsockopt;