Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp834573lqe; Sun, 7 Apr 2024 06:14:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7YtqHeAFQXOoPls9FsZMsWueE3v95WjlbNnVBP+fo/oQzSB1rTPZyWnxuv6w3JKgSyImE0qw1TZxRs4TQPDCSNgHeYZmsHdO9wo2OTA== X-Google-Smtp-Source: AGHT+IEw9yr2klNur9lHN5fGJgu1geH4ZG6E/E6kcYgeDfZEnqbRMFCnX3SodIxhfALGUuxGisdz X-Received: by 2002:a17:902:f710:b0:1dd:651d:cc47 with SMTP id h16-20020a170902f71000b001dd651dcc47mr8223947plo.28.1712495642732; Sun, 07 Apr 2024 06:14:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712495642; cv=pass; d=google.com; s=arc-20160816; b=aJxZxhM2IQ0l5BLrFCOPHGyqJl+CmmJN110Fus3G4RJcSqYZikkc+XwcWro0yCOPg0 czu/gu9LpzJmobu0QeEZduXOCo8KpuS+I6sf0YhB8svR6ajNO6ufFGBilzf3LD42Newd oh5BPTQ+dojkqEqlQQENcu+4e7HaqquZElfrxH9izItmKx10h7CiIn1IerNEhdMSknKJ bq8zDxsdFuGN3U3a1wcxv+5QysP8OORc6kdgOpyiV81C4TqKVzOMyVLSbIiRznxqWtFK SuO7gjGMuKN+XtE8YEzObJOhGONA5/sYeth3v6nWmN0DUVJ/sCMy5kPTeTxeo5Wen86o wfVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ilZhVPqKkmPJOstWVGouC+7kAK+a13in8az6oQOa++k=; fh=D6xVSegNul4KrUJ9ERmiGKlse4yUgZ/4HEoMM009vXk=; b=EaLzXDJI/bziV2R502xStV35rziCrRAQ2qmBebPqnD0k8/JD7WD2X1LaCJcfhrA3Kx 4pUplZABr6J2AEq2DNf6ZrQSepQgHxU6+TBaiTWlLlAKz6qGh+Ve8XJsAy/2LAB8oUJa t0fc8ba3BHSWWzIUaso8Oc2fzWh19Rq8KZgdB/ny85SkPigWDD/QSAxqsy0rWyoZjG+f 4jE5pirTVFCRAcMMcYEmou4kXc+qzaGKyhScGdTm/Fhmzw4yVFdu//Vv07j3dD7FJ0uv d4tV43gvvlQItiORPZd6MZEiNC4YzdCkWCdRszRLwa6q1Of4jBBsRK3vG1I3W7JAwHw8 ktDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-134405-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134405-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b8-20020a170903228800b001e3cf5b15f2si3353025plh.366.2024.04.07.06.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 06:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134405-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-134405-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134405-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6642B281041 for ; Sun, 7 Apr 2024 13:14:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A537240BEA; Sun, 7 Apr 2024 13:11:20 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C88D3F9DB; Sun, 7 Apr 2024 13:11:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712495480; cv=none; b=QIEN90S1P7BpcxnghdUw94TY7Dxr1MfMbjNEZl+WST8z4PvhfNxmriE9o33a+74xsG6k1uzA0W5xWvgDoPQycL3Ier+9loKoeTkjlJ6H5D1DpdU4Ch4ciouM4IVbpwyaPop6e0sWGPBhZb0Vvrhx4N9vvZEt/re1iyFZYBgH7Jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712495480; c=relaxed/simple; bh=77TAy3kea4Va3Is1I0qN4USj8ONZ6KixwSmbOIBXyLo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MqE6BDc0YFgfxKak7+9bGk/OU4yb2yfdnLdOAYvfhSyrggwO6yI8Da16WREjsEYDZP6Nq5sR8Ls6N4+t1KC45a9Gn0ZdowDIpXR4AUGLT85lW09RZlbx4ZBG2efi5G0qttg+VHCqCjsuvv2UeeoP0DmhlxZvXRqominnErJwd64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VCCG32pMPz1h5vr; Sun, 7 Apr 2024 21:08:27 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id 8B7501401E0; Sun, 7 Apr 2024 21:11:16 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 7 Apr 2024 21:11:16 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Eric Dumazet Subject: [PATCH net-next v1 08/12] net: introduce the skb_copy_to_va_nocache() helper Date: Sun, 7 Apr 2024 21:08:45 +0800 Message-ID: <20240407130850.19625-9-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240407130850.19625-1-linyunsheng@huawei.com> References: <20240407130850.19625-1-linyunsheng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500005.china.huawei.com (7.185.36.74) introduce the skb_copy_to_va_nocache() helper to avoid calling virt_to_page() and skb_copy_to_page_nocache(). Signed-off-by: Yunsheng Lin --- include/net/sock.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index a495330c5c49..d214aeca72ad 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2272,6 +2272,21 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *fro return 0; } +static inline int skb_copy_to_va_nocache(struct sock *sk, struct iov_iter *from, + struct sk_buff *skb, char *va, int copy) +{ + int err; + + err = skb_do_copy_data_nocache(sk, skb, from, va, copy, skb->len); + if (err) + return err; + + skb_len_add(skb, copy); + sk_wmem_queued_add(sk, copy); + sk_mem_charge(sk, copy); + return 0; +} + /** * sk_wmem_alloc_get - returns write allocations * @sk: socket -- 2.33.0