From patchwork Wed Sep 20 22:22:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13393503 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 34B87CD13D3 for ; Wed, 20 Sep 2023 22:23:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC5C16B01B1; Wed, 20 Sep 2023 18:23:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E72826B01B3; Wed, 20 Sep 2023 18:23:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CECB36B01F0; Wed, 20 Sep 2023 18:23:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B9F2A6B01B1 for ; Wed, 20 Sep 2023 18:23:09 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 845791607E5 for ; Wed, 20 Sep 2023 22:23:09 +0000 (UTC) X-FDA: 81258402498.11.65BF7A2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id E0A048000E for ; Wed, 20 Sep 2023 22:23:06 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NwONeS52; spf=pass (imf02.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=1695248586; 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=iPQISxqfHMBDGmq2xh7KE5AKkjYoEJA7UeL98xKk5KDJ6SNQlqhhuvlAtkOQvsZ6P/rU2D XGuXK0+yOQMvZIaoqhw9/GY/hzjIrfUnastw5nJJFjTn7yOGKEgjuRL7p9VaXZw7agjsvN RUByxQMIVnvLaa02M9DThkNFCax1sSk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695248586; a=rsa-sha256; cv=none; b=prnon9X3r+3qtBXC0WQVRmcoSWfcNjS0r+stD7ZIzcLSGJ+wO0hZEDtUyPd56oJ8Ja2Dan +Ny/E20fxOgHhosIuXp/vbtiCvsLOJfSwkuxkVV9+fZmkRE6clXQCXK50TyEq3UEL9qBX7 Xlvr4k/+AhbA6I0n/xyLj5KKeFsQCfo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NwONeS52; spf=pass (imf02.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=1695248586; 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=NwONeS52XCpnMFjeVSyTcMvg7i0sydtRUmnxLMae40ZjigVsF9KQNHEv2d1xW555SBy/tf usxOkfo6cV/uAkr1irIDQKDJGjbYbBT/Y63afPzcNd9X5aK3BMxbjG9I9dIEkJnBdsqDAk 3IavTyFwdioofV8c5r1v1tiD0AFQbcg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-8JTl3Nq0NjWy4HtzvZJD0A-1; Wed, 20 Sep 2023 18:23:01 -0400 X-MC-Unique: 8JTl3Nq0NjWy4HtzvZJD0A-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 DABB028EC111; Wed, 20 Sep 2023 22:23:00 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCB8EC15BB8; Wed, 20 Sep 2023 22:22:58 +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 v5 09/11] iov_iter, net: Fold in csum_and_memcpy() Date: Wed, 20 Sep 2023 23:22:29 +0100 Message-ID: <20230920222231.686275-10-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-dhowells@redhat.com> References: <20230920222231.686275-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspamd-Queue-Id: E0A048000E X-Rspam-User: X-Stat-Signature: wq8iioxzrmfuspn5tmizm1zswt7brdcf X-Rspamd-Server: rspam03 X-HE-Tag: 1695248586-872390 X-HE-Meta: U2F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61PlE6k/h/nAPGgW3DKmbz9nTNNrwAiNtD1rCxk3viAh/1YAfkyupSqB+5AlbCCgPJM/0l194lODF9OoBJ6vAZEhCXhfU9qLBeMC6H5ID9VMgvPQS1bdR4fyyrEfGpC9O4z5RoJYiC6Ci2y2OacQi6yzTGlv6ruuEfd3ojqlua7vyrPXms6asU18UWM30grjWdM///l4pkUDvbZeSFOpJasIQOmVChNBoX+bqQC/4fHsBz1vtipEchKLgIExK9nY9T0CMkQJTwe7U7A9NRmJIxtqWnvM3lsMYL1almZBk7DPNEqaqjw2M6BGeawQ6T8aCX1IHRAv28bAmFJWAywwJJPjPgroQMqBelN4yGLxnmMmorynvF19XjWwQ792oHMXqmmkOe5Pk+Z33NW2tIT9CKWqM4aWyqalzJ3Egr+ksmzJ6EQ1a0r/EwF8CDbNg++ndpPLbuIJ/tOUTLUZ2NfEY9RBptJhe7znaUuPEClMDf839j339LPKDg7H5S5gT8COrYdScPpqGxV5zmbxjd8+bHtX9zYvAcsFQWBvJ8hu1bE7aWypYoCfxv5OdUOuA 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; }