From patchwork Fri Sep 22 12:02:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13395709 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 2AEDBCD4F5B for ; Fri, 22 Sep 2023 12:03:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A41A86B02D5; Fri, 22 Sep 2023 08:03:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F04C6B02D6; Fri, 22 Sep 2023 08:03:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 869926B02D7; Fri, 22 Sep 2023 08:03:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6CAD46B02D5 for ; Fri, 22 Sep 2023 08:03:10 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 474381CAEBB for ; Fri, 22 Sep 2023 12:03:10 +0000 (UTC) X-FDA: 81264097740.19.0954354 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 7E151A0039 for ; Fri, 22 Sep 2023 12:03:08 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ecjndrne; spf=pass (imf25.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695384188; a=rsa-sha256; cv=none; b=awFeekj4Rb95mQymdvPkgPPcEMV28M9bs3VZahAswZBBj0wfGYSMLplat4HWbkftvbii1G /M/XpTukq6it/9orHc5tETjbvkMghUUHBG2sQXj9BezbDqjuzqLvWDUq08uXNCkAUvzE+p 3H0+HCTc3Hw8PixMO5XtNfiMBNoEvWQ= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ecjndrne; spf=pass (imf25.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=1695384188; 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=i+29vAFZrXF9naWng0ipN/2z31gEil+IMifE0VymLF4=; b=YfqHS6Twmct0Gegh6/J0vLKhOybhWBYwT/lR0Vo1Givq//dqvuxLj4e/Ehg+vn3CKuNyWl 9bI/9AzgB1NxZ2O1fx9wvaxojsckBV7XlxgL+Aj6jycF/uwNQIeC/SkARB0jNjCe083bQC 69X1WisT4nqpgIeKfV/oP1QPdsrpUlg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384187; 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=EcjndrneaDCzFMJP+nm2WTSUbeivCV2F2X6cdro+I5werZF1x9LyYc8qaQDrehYZTi20iO R+i0x3RkApsBypLQfMoxazN6kUIsi0Gzo6pXGmY1jPJVEqZ6RAQddEOxJB6ak6BNd0922y 18p8wjL9fP6UCy3d46iaDCT9uMMPFtk= 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-142-CaRM41xMMG6W6r4YEJltnA-1; Fri, 22 Sep 2023 08:03:00 -0400 X-MC-Unique: CaRM41xMMG6W6r4YEJltnA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 B3A55811E96; Fri, 22 Sep 2023 12:02:59 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA91D20268D6; Fri, 22 Sep 2023 12:02:57 +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 v6 11/13] iov_iter, net: Fold in csum_and_memcpy() Date: Fri, 22 Sep 2023 13:02:25 +0100 Message-ID: <20230922120227.1173720-12-dhowells@redhat.com> In-Reply-To: <20230922120227.1173720-1-dhowells@redhat.com> References: <20230922120227.1173720-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7E151A0039 X-Stat-Signature: qki8ce1z9w4mnskea8d4n1e4iyakwsmf X-Rspam-User: X-HE-Tag: 1695384188-712468 X-HE-Meta: U2FsdGVkX18hno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v7sAbVvjoVEIiAlrfceE5LWBPC/7lNfqgPCy3i6WRPQq+Wr/HQfpRLDDeGw62JyVagbRRN3TJ13ijOR/Gw9EbVE6JmYiTjCIwZ1uWDbu90pZoHi7SSu70zTtupmqTcunSp2XaaWnkQ0sRvddoFLW6UIhRv0qlB7lxIu/LTv1+DAkAMnoBRkUMwPvsj7fByrMZMK3DMu6Rgqw2C0Owxqh7vuz6Qln+Zb8YHz4VrXCV/rqXFLqZY+5rS8td9dv4oqGuhviDTEmYJV7z2dt0pgi6cNY5Gy09vOGezGr3AEnp96UUek7cMEUvTHIrUGY2itGn5on/omSrLUcj8vHuEd55z94Ae6PYD0jtpJMXz2RqxdVPUv6W/qHe2gPYhxigee8e0isqLhnq/Oa00TKirxuI6aILFw681S5/fzOV3BvrZhI+cy7mXUVBTZd4CSOAF2yZj32371kSOMorxnVF4c7SyTncmEsryvOCC5gwVr9bVOMdXQ58hnK4jQV3kvHelkwsNdWMKww6EviCEk61qSeYNMo+rGK5ZgqfrXag7PjGjjpAP5S6OclMvhncW2RIfPXs 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: 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; }