Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5891107rwd; Wed, 24 May 2023 08:06:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hk/pjS09KZP9v0A21jfoXfAlKJqOZVhgERh986BwgvqyLgepKj1vshzZNtQM8JHWOg/3x X-Received: by 2002:a17:902:d50e:b0:1aa:dd14:da98 with SMTP id b14-20020a170902d50e00b001aadd14da98mr19988119plg.50.1684940813202; Wed, 24 May 2023 08:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684940813; cv=none; d=google.com; s=arc-20160816; b=iG/E09xujbz+0hrTaiCvFLztlUZlziynPVcKa6W9kc2Cu4H001JrURbbKluapk9Z4B DovvxoC3B1ydTMB0z8kGCdV+lWtUESPGt4DN6XtsKgLKznUxCq4xbNn+dAi5mpa2g1gf SJ2dXvggfnlz2ObpQmmXIICWpScs21vcXEfgDXU3HkHlRTJ0A09RcWOvPDqLIf2/7RX8 ziHwOgl3mhXZ0PJ6pOfbW1zw1bpMYoSybLp/e2XYgOrtnt7WaXBLoXZoy7FOHPLrdx0a T9kHHrp+6ngPD8tlTlTOrV/1JpJIfBJt8JpNluBluIij9hcIlf63m6TjuRoM1I3Mo1ZH Kh8A== 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=97CTgaKk+HjxMsHB1NZqYRmtg/935y1khOuMG78saNk=; b=LEYNccz0Py5llODIjtCSs0XqmVevCTio1X4miF+kARGmrSpcnLYiaB2RwYOigziLbg GFnuBd4qabboRNXe4fuAlGbQ2viOyppJXg9TSFCR1GTANSB0civhy4QnxyRkiQr5NkCe AGvAn8eveV9jsopfGK/AY7zeZndMDjjkG4xhlyHY2Q4K2QuoBiloTZFRCKr44bH5OJvN xXL+icLbK682BsuJgEmovrPA5GY/IBW/vgZ2iUgqVqt4zkEVHF+Nh1FZmM+GbpjdLr6u fJuCS3poTG8mvWgv924swiA3A3vaTK7NVyoE2XtSdPDvgRnV9CPsGGUy3yCP6BmoacZX FfSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=INoNHH81; 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 iw17-20020a170903045100b001ab1d1a6802si3550972plb.1.2023.05.24.08.06.39; Wed, 24 May 2023 08:06:53 -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=INoNHH81; 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 S236049AbjEXOug (ORCPT + 99 others); Wed, 24 May 2023 10:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235481AbjEXOuU (ORCPT ); Wed, 24 May 2023 10:50:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68E70C1 for ; Wed, 24 May 2023 07:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684939776; 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=97CTgaKk+HjxMsHB1NZqYRmtg/935y1khOuMG78saNk=; b=INoNHH81Fv5iSneT1VZQguhRtUuRmWuHHxXlu1J1Lcl0EBwm/MePl7vLwd3cl5sYM0llrF e23zgF+iCDAybPfA3y4WeJUjgSKKf8DZFUKuN0IF8eY1bEi9m5/VZr6rd0XuD4qPE9BA2r 1aylhzn8mqgSbb8l1A7PAHMwwwunHjY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-Tcx3RMC7MxyDhN2LK1DGPQ-1; Wed, 24 May 2023 10:49:31 -0400 X-MC-Unique: Tcx3RMC7MxyDhN2LK1DGPQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91F1229ABA03; Wed, 24 May 2023 14:49:30 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id A11011121314; Wed, 24 May 2023 14:49:28 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , 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 1/4] chelsio: Support MSG_SPLICE_PAGES Date: Wed, 24 May 2023 15:49:20 +0100 Message-Id: <20230524144923.3623536-2-dhowells@redhat.com> In-Reply-To: <20230524144923.3623536-1-dhowells@redhat.com> References: <20230524144923.3623536-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, RCVD_IN_MSPIKE_H2,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 Make Chelsio's TLS offload sendmsg() support MSG_SPLICE_PAGES, splicing in pages from the source iterator if possible and copying the data in otherwise. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. 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 --- .../ethernet/chelsio/inline_crypto/chtls/chtls_io.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 ae6b17b96bf1..1d08386ac916 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c @@ -1092,7 +1092,17 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) if (copy > size) copy = size; - if (skb_tailroom(skb) > 0) { + if (msg->msg_flags & MSG_SPLICE_PAGES) { + err = skb_splice_from_iter(skb, &msg->msg_iter, copy, + sk->sk_allocation); + if (err < 0) { + if (err == -EMSGSIZE) + goto new_buf; + goto do_fault; + } + copy = err; + sk_wmem_queued_add(sk, copy); + } else if (skb_tailroom(skb) > 0) { copy = min(copy, skb_tailroom(skb)); if (is_tls_tx(csk)) copy = min_t(int, copy, csk->tlshws.txleft);