From patchwork Mon Sep 25 12:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13397697 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 AD7D9CE7A81 for ; Mon, 25 Sep 2023 12:03:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C39676B015B; Mon, 25 Sep 2023 08:03:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC59F6B015D; Mon, 25 Sep 2023 08:03:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3F5F6B015E; Mon, 25 Sep 2023 08:03:52 -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 83E196B015B for ; Mon, 25 Sep 2023 08:03:52 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 56B0C40BD3 for ; Mon, 25 Sep 2023 12:03:52 +0000 (UTC) X-FDA: 81274985904.02.B1645D4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 5C92C18001A for ; Mon, 25 Sep 2023 12:03:50 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OPR6Y3Vi; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695643430; a=rsa-sha256; cv=none; b=nJf84c9ARQytFoWJpHLvJ/pReBpUnxtXFMWbTEE4C2Jxj+tJH45QPVZoiFB5waGvfZx3ON X0+Q9U07v0mWcP+j3LlUuTCfEeUv7XX1XcP7VPmLg9ZRLRSbkXZyaWYM75sL+Ik2ueeJ46 SHaMfkK2JKMURwy56jPidTrZXcjQu28= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OPR6Y3Vi; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695643430; 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=1WjgufKXC6CVwvxcQX6qBYZJyhOIsILtwRmoyrDyfFeai6GzjvplKZusi7EKJo9vBg7k9l 6xgKfWNfGBubbRP4VJw1g6QBhuyCKSY6syEHiDcEZH9GYba1TV7sLEhmmPWbRVmJ0bMo9j a3SFFLSNQgtLGHjhce7fXaomCnt0RoA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643429; 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=OPR6Y3Vi1gbzs2/qTR3HPOtXjw8N39kdyyJiuPHXHSp56QiKjl0jv7P9t1Mns2JZo6QQ5y 6pfWfTZrJJis3DkTKH7oFwFRrMGRd8s66Z6+r5lj9TQ7n6LGrEzGT1MNKwNmtku2ccDO5K pZ5pk201G+zCshLFFuaJEEOLaECTWWI= 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-47-rBgXHwEcPtC09KsWTkJlvw-1; Mon, 25 Sep 2023 08:03:44 -0400 X-MC-Unique: rBgXHwEcPtC09KsWTkJlvw-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 7DCE3800045; Mon, 25 Sep 2023 12:03:43 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 770E5C15BB8; Mon, 25 Sep 2023 12:03:41 +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 v7 10/12] iov_iter, net: Fold in csum_and_memcpy() Date: Mon, 25 Sep 2023 13:03:07 +0100 Message-ID: <20230925120309.1731676-11-dhowells@redhat.com> In-Reply-To: <20230925120309.1731676-1-dhowells@redhat.com> References: <20230925120309.1731676-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5C92C18001A X-Stat-Signature: 7u5jbupwwb85drc4kcdfj3bt3h1oc5go X-HE-Tag: 1695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7fz+H6tVwXUZaW5jaV/zF24H/QAgE4oZck9ETEg5+QLW+3CC8Ny489pYNkkW15msBth/zPrNC01MNQ4/GWmd/60HgP+ibpMG7GQcsYeSmK21JZ6BZKfdV/0z9gy1u/mJQwfUXsVX+r73UdDuDhOY60X3rP74551D4H0IkrG1N9cYHZweX9io64zAt2u65hganU+FVSpwOCZ/N7TEDXXFPZWqmc2GSatSAUpNN9qAM0LHFOsVCkAcAzUsdaGxqKfQF5/sVGYky+RDFJWsu+tbZWPrBNUBM/4HBhkXUnE842ABFhe7pZdtU5Y3pKZA1LBwbHw7UGzduNaIKMEMSVxPOMfWIBxzQ8fdbIvNYWLgmCggHf36jkVJO8gdO5+8SLDpimktzLPW6dQ5pE/YX9iLLn3soxnsmn1HfC+9J+/ThsOCt4p4IaaLsN4ZIM5kWA0ke8zD5gv1SrTuVoHZ8emqwoFN4aEjmUJQwNFgwOjuLZwJW7zvZ9j/olWq+X+Nc9TcAokBfnTVMih+N8DxCxSmX0D6Vy2GfviVzCKP13/VWWH9u+xN+STPpdxGjtBJEdBM/EqPYFV8m3ht4ISc19unQ3 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; }