Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1432230lqp; Mon, 15 Apr 2024 06:34:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+XJVkYgnt12K8qj5ZrcYIEN013URT33rgr/MHpD/VznW7604VEFLs+igqWE+ThIuJWxHnGgkLICGk9v8mzOlhsmACs3V1I8qNMyehig== X-Google-Smtp-Source: AGHT+IFdsF8SEanyfLe4e+xnxJOYKC9JN7zvtTfoehoqUbEhzG2bviiTHTNkzitSC0eRchzyT8OK X-Received: by 2002:a9d:7ad7:0:b0:6eb:7250:a8c with SMTP id m23-20020a9d7ad7000000b006eb72500a8cmr6457925otn.0.1713188043881; Mon, 15 Apr 2024 06:34:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713188043; cv=pass; d=google.com; s=arc-20160816; b=uftQMe+UtfKDFpXcalAlEkBuqMMY5Bf58PTTMyDLG5pwyyWTC+ZQb1qdcVEHr+Si5k 4GHRgG/i6T4366yiyYdA3Pt/vQc7x6wObz/AN4AAyH9ERUMsAhERxuc++B8U84asA8i1 KH7TJxmNbzUVR8MZGncO6Hv1XAsYCh2+p+TR+lhDwagKs1KVqM3kUYcclJXWVAfJMCHO wYHi5iXUkoy5Jqf4AbNxqQJlrcrDOpMleXQGLkUHfdqXLRAS0T2tLLlfE3WpqA7ANirm 0hg7t+zQlJWhlpLuLcHeZEKRbMXyua2ngAoNqOqzAXX6C8A0m7LlH2/u5cUmuZhimSuz l8YQ== 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=G03QIYIGrkNr2pgyvqR5nlDpIQVcUDPZqjKwdZ0cFtdimr5U2FBajaWJYz5e+hgmrE WQ6m1sL6jcE6BE5SCAgUFeUgv6isNyfYcTQ3B05LYzDmmE8IiauOWKBm/Uc30YLODjsf S0oT6iIeZbipKxcaDsSMnVXaMuir9i7ScILJqNRb4n6nZK50OfZYhYIpdA0I6JmT8Wu5 K5Nlcy0j+Rbnbs3dqGjVayBldTY39hVHnSpTJC+T+0z10HUoHnVUL5f8IaIbRMDpoiOV Bb0PxGV0ZPWV9IioEeONfX96zQucCwt9MRLT+JLL7j8F+VTICYrGK8YSN8RZtbWjuVWt 4z+g==; 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-145253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145253-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c13-20020ad45aed000000b0069b6b4c0ee4si4970693qvh.616.2024.04.15.06.34.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-145253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145253-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 95CC81C22000 for ; Mon, 15 Apr 2024 13:34:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38AA412DDA1; Mon, 15 Apr 2024 13:22:22 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 CAD1812A170; Mon, 15 Apr 2024 13:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713187341; cv=none; b=a5LhcRVyoWaCSX27BGaId/9UWCaDSPKbeqUbiCCtl6xe0/l7UOhEafEQst/ClBZKUK/s2Q7Gg7+EbpQ0Lu3UmkrMX1S/TtLs4WVMEdMtPvRIWhbWIP72OO9DgNcDu11NtNST3ft9fs58n3yACIFs8myGaLLrCGb7En74TFPVhmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713187341; c=relaxed/simple; bh=77TAy3kea4Va3Is1I0qN4USj8ONZ6KixwSmbOIBXyLo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tBv/NIOvQ9DEiH7aTyMT6EiCxcj6Eznay6IOLwVDHJAVuXbUyZ/Fbkpi1r5XFX5Vl94BXN94IL1zfsU4lF1HpIIzch0jt93Vf5YijYt7zznJqtEAbXvTxCOlREXrUoMLHnCu9EcaizsAaxOE6DZ41SkFgIOOND3L5gmXFzOenXo= 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.188 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.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VJ76Y514PzTmQ5; Mon, 15 Apr 2024 21:19:01 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id AD24918005D; Mon, 15 Apr 2024 21:22:17 +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; Mon, 15 Apr 2024 21:22:17 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Eric Dumazet Subject: [PATCH net-next v2 11/15] net: introduce the skb_copy_to_va_nocache() helper Date: Mon, 15 Apr 2024 21:19:36 +0800 Message-ID: <20240415131941.51153-12-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240415131941.51153-1-linyunsheng@huawei.com> References: <20240415131941.51153-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: dggems706-chm.china.huawei.com (10.3.19.183) 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