Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1144912rwd; Wed, 7 Jun 2023 11:39:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BPLOQcRMFIOhheNYRAWKnHTU5AqFeGlSAAO409fOBQpiBA3vSn28qBw/Aumsq09jxYczK X-Received: by 2002:a05:6a20:144b:b0:10b:b762:7694 with SMTP id a11-20020a056a20144b00b0010bb7627694mr4373433pzi.17.1686163153335; Wed, 07 Jun 2023 11:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686163153; cv=none; d=google.com; s=arc-20160816; b=oSaF3Xs79eu27uDgXE7QdwtrOK20YXj1cFdXIF1rjnvrDkRG4kbqJO0mhUTFE1taMp 5csMeX3Ce9cLi87H9Sz7vPl/cnZlIV7kTW2YQkwtOeJoAKwGsyaBoxmF0lDRAgy8agsP vA3i1aVIaZ5oI5QKQK20j7s0KU0zF68AmRcz1XAjjStLPVZg08AjGY9s6w2DIXCIrFb7 +ueBDXbU4f+hsATH6MxJ+t3SfvlBz3VsW/3gtKoBXNRRo8pxa1Ti2os7tDaUEQ7OTj7L 2PjV/hl7hfro420+ycioTAXFOkJs7xIOfUIDmW9CK53AfREfRdINpre88b7dl2ruGQ3B GkUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=axbQ2fmWT7oadEpv+RKPywBYD27/saJPi8A/5AZqeFc=; b=VOFxJ7ylhiC6hCp1IX7xLm3c1dXyfXL32/ICqmaksPztjNp68Apza9nWF91+qVL0y2 31QNLGuT9rzOHdOjIavurIvSBvTq5hr/3rCpKIuFMfXIwcfxmjAZz/SDhOd1YE7S21E8 nZnf/c/xKqqBQ9YhpGh5j3OdKWzC7XO4ajzoukXH3i/l4LdesDPQnt/f+6/6p7baIk8Q LQMXUZoh9wJd8fSzwTNpJAdTJ0yOgA6OJZZATQj375cU0kBtYPgkJfRIVVMv56SFWvEA XzA5fitjvAlxaj2jWsyZVIxZvKiemCgCYNg8TjBLrMrL4hZ2ct3nJeZ/7EPOIoCo4BIg o9qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gqR5U08G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0054403507e7esi2188990pgp.180.2023.06.07.11.39.01; Wed, 07 Jun 2023 11:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gqR5U08G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231622AbjFGSVd (ORCPT + 99 others); Wed, 7 Jun 2023 14:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjFGSVA (ORCPT ); Wed, 7 Jun 2023 14:21:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADEF710D7 for ; Wed, 7 Jun 2023 11:20:15 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;