From patchwork Wed Sep 13 16:56:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13383575 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 E0C67EE01EA for ; Wed, 13 Sep 2023 16:57:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83F866B0205; Wed, 13 Sep 2023 12:57:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EF0C6B0206; Wed, 13 Sep 2023 12:57:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 667316B0207; Wed, 13 Sep 2023 12:57:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 53EA06B0205 for ; Wed, 13 Sep 2023 12:57:28 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0B3DF1404E3 for ; Wed, 13 Sep 2023 16:57:28 +0000 (UTC) X-FDA: 81232180176.30.7C4356C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 4B71E20029 for ; Wed, 13 Sep 2023 16:57:25 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JQP9vyD7; spf=pass (imf13.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=1694624245; 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=aq4AM/DGD5TwGifzjAwlds+Q+LnaqGijz6UTHBmYwW6dtsFM5NP9gBMpdX4DTrUySZr7Mo 9LQu+YbjeZCDXY2zHbGOI3zOD10Ax7B0RJi8uYClGBwxiz+F4vcuE3WNdqiFLC9DrZqax6 koA8FyWi66IDsRoSTD6Wx7+f554seZA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694624245; a=rsa-sha256; cv=none; b=i9VfDZ9jABPhDP7LZS/LOoVDVS6eTbCsZaPumrt5GapV3rnQviUmJEdpfsVGzBw6ukdmHW CHid1ycMhzmyqEXLpuwoDVehcDVUxPoPBf3rGOt1XzVBnvOTzuqkLU7gN62XBhMx8ZZ53b 3hiDacVyw39kD0d0yi1KOb99jXDX/CM= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JQP9vyD7; spf=pass (imf13.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=1694624244; 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=JQP9vyD7fQWsuYrP2ettkddyKXIQvwkl4xMokCSzknDunTUr/YNo95k6h15qs3acYs14+G 7TWrykYzNP5v1IXQhXYOfYpAzVP67PdnpcWT8PeWiUpPNGtYUqr4QCZ61J6/5ItqWu2n9m h9mNRNgNTZr9WTpOaqffCpnibTlOtwk= 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-536-VozdxTMENjmI9CZVmuDJyA-1; Wed, 13 Sep 2023 12:57:18 -0400 X-MC-Unique: VozdxTMENjmI9CZVmuDJyA-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 728E5857A9E; Wed, 13 Sep 2023 16:57:17 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DF682026D4B; Wed, 13 Sep 2023 16:57:15 +0000 (UTC) From: David Howells To: Al Viro , Linus Torvalds Cc: David Howells , Jens Axboe , 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 v4 10/13] iov_iter, net: Fold in csum_and_memcpy() Date: Wed, 13 Sep 2023 17:56:45 +0100 Message-ID: <20230913165648.2570623-11-dhowells@redhat.com> In-Reply-To: <20230913165648.2570623-1-dhowells@redhat.com> References: <20230913165648.2570623-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 4B71E20029 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: zjmjdbrr3xd8y15f7yy8xn1tcnjfjfrq X-HE-Tag: 1694624245-469701 X-HE-Meta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R/TubmmLN2a/EI4IxSBAVZwRg9wF6eCWhgpIhnBQGf4zoNu+gZjCQpguwy5RzjXLPGvIQide9tOr/IkRPV1FlrVfXKMZPWtz1oN4tZEY/w3uK7tH0lfE0hg0WXo2LziIi78llGT8Yo+ajbPpbMKrU3WUuF6LG0/VCX/dncQxx0UXHVTaytkXp0mU9iLT69kcR5GAwk57FI0ItgQzW1yFxiuZFxK+CE91lfhlPQgu9S9LdtckLjS2tJe1sORgGqJgRsh15fdoH8XbYYyTyaV9bZ1MXflTIimvCgC+w49nTo0L0MP8Gbiak2cthEFtEPa1MuJJc7RMTfxT7ve+noN96mV+XnAMNE2v6QWZTwEgo6F1AZWHLG7iteiwpmE7BDeVZ4eXUhc4xHugdYDG3i8GushfZ3qbjsyPgKc2pwV5UkStmcvTc6EnrLGbaAcDU9E3rXlt7IIcMQxHADb3AcSOLFOrHACABn1gah7++1kkAnwm38pFOOQJGvPfhsJbYc6ZaiCVXxK7mcjPQeDmgXg50L+CJrIFl36Gn337K4FgfCDTWOoyJ2QCiyw2sGKZUNJmkTG0HOYEU2VHTH+ 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; }