Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1457037rdh; Mon, 25 Sep 2023 13:27:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFEFyDClEy0tQiL5uKm3cscm2dnRO/6P9kJXil1vDCI06vPIEKzKh6E9wKFoKKM7XSBFw5 X-Received: by 2002:a05:6a00:c86:b0:690:2ecd:a599 with SMTP id a6-20020a056a000c8600b006902ecda599mr6487966pfv.21.1695673623363; Mon, 25 Sep 2023 13:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695673623; cv=none; d=google.com; s=arc-20160816; b=VSx7vxMO2gFpqkB1lZuw1K6Qnq/LDs9Nxc4R6g8nJBqOmO0ONTqJ34sbr4kG+rEH4I 4mjpMegg2BRuZxPKs22pzBD0qy/y4JwJuimhRnQo5pxyug+SVe/dD87JDvnUnc/ECK1u p5303cX2/AYJnGPOFxNc6ewEXFr10ZQAdjDupwijn99In2RgjSdM2cWXmbHaze0s0OUZ yJVNPkQ6JZK8pZTsbFDqnVkjLI9sRfqmqjwauTuhL6Pdg3OzxVfaKQR48bCIQBO1rrwP UnK51hd3c2i0QaTi3CrZDaumMnHIZ9r1bsoLICNcwPSs6gt0/dLOrmWy8vAd5ts+Qw7s VVwg== 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=BnkGqOjkxerc8kc2UNRpGeQ0JG1EG3KNfuIkiMPorZk1vPsyB8DsStjElJxTypnHjj 5W62CiLcdIY8V9/4b2WxbaH7ywTEEbVNGFs1w8PIG2EiwS9FSOCEE3kzJBVzNC060kMK HzaUYSjye5Ynv+n/DQhEyeUgGmWDdNxv9EV/pda2GOOF30O8/oKkv/NabC+VJiJsbg6t 6zxzbtJV665BNWe67sc2KL6hBP9JJqERwE0pt4W+0iqS17VPIELo1shFaPc5GqJHNCoG G2ryln/2rVo8y0v3+smqxRDDMseR/CPtrCTbLwM6CzzePMivs2du0pRIEf1esi/+8mqJ QTIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="gQa23K/I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id n32-20020a634d60000000b00573e3b0d3e3si10535140pgl.408.2023.09.25.13.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 13:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="gQa23K/I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 71DE982357A1; Mon, 25 Sep 2023 05:06:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbjIYMGG (ORCPT + 99 others); Mon, 25 Sep 2023 08:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbjIYMFl (ORCPT ); Mon, 25 Sep 2023 08:05:41 -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 5F62E1A7 for ; Mon, 25 Sep 2023 05:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643430; 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=gQa23K/If9UT9bCAYLbmgfEdZzBcH28/OCitjzUNBhKJfZ3Jk275j0RD5Uo5PM9OPK2XaK XppSqCO/7I8Nyq/bAU9sarny2mbDvVNLt2sc4X4LCKE5HSSYxU6yqh7craTEuoEzppd5gf y+Agg31MtqtW6cmy2l/lFJIxrHwK8o0= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:06:10 -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; }