mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Yunsheng Lin <linyunsheng@huawei.com>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next v6 11/15] net: introduce the skb_copy_to_va_nocache() helper
Date: Wed, 5 Jun 2024 21:33:01 +0800	[thread overview]
Message-ID: <20240605133306.11272-12-linyunsheng@huawei.com> (raw)
In-Reply-To: <20240605133306.11272-1-linyunsheng@huawei.com>

introduce the skb_copy_to_va_nocache() helper to avoid
calling virt_to_page() and skb_copy_to_page_nocache().

CC: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 include/net/sock.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/net/sock.h b/include/net/sock.h
index 5f4d0629348f..7541f8dd1746 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2203,6 +2203,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.30.0


  parent reply	other threads:[~2024-06-05 13:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 13:32 [PATCH net-next v6 00/15] First try to replace page_frag with page_frag_cache Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 01/15] mm: page_frag: add a test module for page_frag Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 02/15] xtensa: remove the get_order() implementation Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 03/15] mm: page_frag: use free_unref_page() to free page fragment Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 04/15] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 05/15] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 06/15] mm: page_frag: add '_va' suffix to page_frag API Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 07/15] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 08/15] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-06-05 13:32 ` [PATCH net-next v6 09/15] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-06-05 13:33 ` [PATCH net-next v6 10/15] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-06-05 13:33 ` Yunsheng Lin [this message]
2024-06-05 13:33 ` [PATCH net-next v6 12/15] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-06-05 13:33 ` [PATCH net-next v6 13/15] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-06-05 13:33 ` [PATCH net-next v6 14/15] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-06-06 16:37   ` Jakub Kicinski
2024-06-05 13:33 ` [PATCH net-next v6 15/15] mm: page_frag: add a entry in MAINTAINERS " Yunsheng Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240605133306.11272-12-linyunsheng@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®