Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1777706rdb; Wed, 20 Sep 2023 21:42:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+0jnpkM55RXXdwsdvaxJVZW6TcgJ31mRNUw2TWCMSD1ghOacbIk89odUkXnDPOenk7DoN X-Received: by 2002:a05:6a00:1813:b0:682:537f:2cb8 with SMTP id y19-20020a056a00181300b00682537f2cb8mr5542961pfa.26.1695271371438; Wed, 20 Sep 2023 21:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695271371; cv=none; d=google.com; s=arc-20160816; b=MbAhE+Iz80nlGhuxboyj/BEOucWDdySZy9xP+j41yTycKgmJDaqfy9oxgsZztp3eDE 4qmNGMD6UYL/SnRGOU5z0MMr5Z1Xx5SqWw0hlFyc0OFl6X94dfxsG5vg7eaV0pPQG/N7 GYgqB55ljncNurR8UdJTMxDAyv1cLmWreCPwkXirDzPYV0ebst+Lg4RsDffuYH2MWhtE JaJXisiscC7vbMZTOLrhK03088Msbf9bnYm67chQvKTBECFI12fXBWIiXrV+WULEZwXO PLwmWUXYbayk6+vbnJndCCQqvv7qmq7s0z3Bk2v+v7Pd5xudP0EsN2FN2STjcG6tL+Ok q3QQ== 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=i+29vAFZrXF9naWng0ipN/2z31gEil+IMifE0VymLF4=; fh=cUIFmDBmiNtCljJS0u2YAiYJr0eIJ0lOVriFs6OgIck=; b=YyjxZbsVTmbSuB58X5vfkdQ8QSRt/+kUABXNyh20y0NYbFkm3CPa4yi+MlEaHlvRo9 zoNh9Eoe0yXJeCJeH2qQT7xtiIRy1X0HNW5C1PbhumKZSSHamZFh6/esvcSKIgfITwY4 wVfMJYt0fhlntwkr8H18nxla3LJ0Wo9fGh842YQhqYI4tCsDmPznupNOkwBroT+OvHBK w5x3aiKoyAxZcjVWWHjI3zrZ7KQd0LegAuZbdlvbZ6r8HH/zm7ZK8RJ+IyGOC5dKjk2N 2yB4ZzZMof/JUqCapcoAnfN5AOqq+xkObCBXXSP6l99PQGOFPD5id5gN+/yFLeQFnyEp TG7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KzDJ//Xg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g2-20020a056a0023c200b0068beee4922csi688962pfc.23.2023.09.20.21.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 21:42:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KzDJ//Xg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F2F1281E7264; Wed, 20 Sep 2023 15:25:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbjITWZH (ORCPT + 99 others); Wed, 20 Sep 2023 18:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbjITWYd (ORCPT ); Wed, 20 Sep 2023 18:24:33 -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 03DE1128 for ; Wed, 20 Sep 2023 15:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248587; 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=i+29vAFZrXF9naWng0ipN/2z31gEil+IMifE0VymLF4=; b=KzDJ//XgpDURVAor2XXWfA91d7rSZAVIbiBgH6L9pkA+WTbtAR4ddfIBDEXPos6YntgIsD jp3TIvTHfKHlNiy2g/G+udyQYg6tn4jubatUrlJuluY7Tew89384LnjhMm6VzzdwHcldxg OuQb7wKl3D65pgz63frW1kypxpQ3qvE= Received: from mimecast-mx02.redhat.com (mx-ext.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-594-8JTl3Nq0NjWy4HtzvZJD0A-1; Wed, 20 Sep 2023 18:23:01 -0400 X-MC-Unique: 8JTl3Nq0NjWy4HtzvZJD0A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DABB028EC111; Wed, 20 Sep 2023 22:23:00 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCB8EC15BB8; Wed, 20 Sep 2023 22:22:58 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH v5 09/11] iov_iter, net: Fold in csum_and_memcpy() Date: Wed, 20 Sep 2023 23:22:29 +0100 Message-ID: <20230920222231.686275-10-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-dhowells@redhat.com> References: <20230920222231.686275-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=1.2 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_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 15:25:14 -0700 (PDT) Fold csum_and_memcpy() in to its callers. Signed-off-by: David Howells cc: Alexander Viro cc: Jens Axboe cc: Christoph Hellwig cc: Christian Brauner cc: Matthew Wilcox cc: Linus Torvalds cc: David Laight cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org cc: netdev@vger.kernel.org --- include/linux/skbuff.h | 7 ------- net/core/datagram.c | 3 ++- net/core/skbuff.c | 3 ++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d0656cc11c16..c81ef5d76953 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3679,13 +3679,6 @@ static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int l return __skb_put_padto(skb, len, true); } -static inline __wsum csum_and_memcpy(void *to, const void *from, size_t len, - __wsum sum, size_t off) -{ - __wsum next = csum_partial_copy_nocheck(from, to, len); - return csum_block_add(sum, next, off); -} - struct csum_state { __wsum csum; size_t off; diff --git a/net/core/datagram.c b/net/core/datagram.c index 37c89d0933b7..452620dd41e4 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -732,8 +732,9 @@ size_t memcpy_to_iter_csum(void *iter_to, size_t progress, size_t len, void *from, void *priv2) { __wsum *csum = priv2; + __wsum next = csum_partial_copy_nocheck(from, iter_to, len); - *csum = csum_and_memcpy(iter_to, from + progress, len, *csum, progress); + *csum = csum_block_add(*csum, next, progress); return 0; } diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5dbdfce2d05f..3efed86321db 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -6938,8 +6938,9 @@ size_t memcpy_from_iter_csum(void *iter_from, size_t progress, size_t len, void *to, void *priv2) { __wsum *csum = priv2; + __wsum next = csum_partial_copy_nocheck(iter_from, to + progress, len); - *csum = csum_and_memcpy(to + progress, iter_from, len, *csum, progress); + *csum = csum_block_add(*csum, next, progress); return 0; }