Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3656155rdb; Wed, 13 Sep 2023 20:47:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWz3VZYDDmm85G+ipTeKztZrCAaxxKZN0aryOSTGMzQOM7KKT+B7/VHYEPbjXdXE8aHyPB X-Received: by 2002:a17:902:da8d:b0:1c4:c0a:b656 with SMTP id j13-20020a170902da8d00b001c40c0ab656mr1204274plx.19.1694663267899; Wed, 13 Sep 2023 20:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694663267; cv=none; d=google.com; s=arc-20160816; b=uui3Lfn60/wx6t4Pg0kkEHllPSyQ65q39HDpqLompDOdZHJFzDOupoy2zm6g1Sqm2P hFjVNKFKPneZ1aPo4NQfzxtQM+L3VkQHeSkg2MmqqQPjFxWdi3uQm2ffplNUqHnYYoeu mL+rSoemsR3wSvFe/wt6QS1MYlbBPTNALsiNCmVUZiLm5w7t506zbj4xTukocDhoVV8W g78yOX2+UOJg3M4bEV3SWQL/iFNCmzZhLJbkaWCI+Z6QAmBY3UVWUPqllI/zm/l2JCD3 tFiBQbitgdWQZ4c5P3oqJtjz3OHjPHxhxfiQNXmP9GS4jqseM7zHn9W92OL2vxjylCSy vofQ== 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=D00b+ExO44XKLceYW8cVdIEOVtr2e1iL7r354EPHkWw=; b=qTieTFWcykfN2B/GQlLSZpcipuYp8hCvpxbc0IxHfqp1pHqhR2Wx4Cy5POnWqDNtLj qMiljtg5K5WjAGRlSM/CjayvJCPr12KH2ZeFkH/km2shiY+8BNy/wMHxN1j2C+YYKLky wy388KEJ8/Qg4WVgAn2SRZ2ijXi8N1Yjv1GR4O96wa3Wa+5JvUFc2Q2lLfOX9SMWW4Es bXc5w+mSUYXxC19aARoHII/uupQFBxx1iQssj9pL3yaeMmKd4rwZpziIkfqrA5qLWfs6 +pQ/1aXURJWDL6Kv/Pkw5xgrUf/vH63lHzUDx05CvbUJwEJgN15hu4StMwmrA85jpkw7 AvwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LT3y4Q7L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a15-20020a170902eccf00b001bf01fee6bcsi763742plh.610.2023.09.13.20.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 20:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LT3y4Q7L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 624FF80B909F; Wed, 13 Sep 2023 09:58:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjIMQ6u (ORCPT + 99 others); Wed, 13 Sep 2023 12:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231328AbjIMQ6U (ORCPT ); Wed, 13 Sep 2023 12:58:20 -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 ESMTP id 643361BF1 for ; Wed, 13 Sep 2023 09:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694624247; 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=LT3y4Q7Lmppy8WKwJwLzSdPbdfBQfMfvl3WzYLbPmqVfBHcwFFVIxK0xoeE9xSlirXtU1W XEWzNXt08ZUbmFa+Ajn/uc2gjlqDbaGe42lJUMsOeq0xvthRMXzwe2fv1/PmwkEAsNBK1t uaXdzhoxT5VvMOqXspl7JPrDUK8bXGM= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:58:59 -0700 (PDT) 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 morse.vger.email 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; }