[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240407130850.19625-9-linyunsheng@huawei.com>
Date: Sun, 7 Apr 2024 21:08:45 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Yunsheng Lin
<linyunsheng@...wei.com>, Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH net-next v1 08/12] net: introduce the skb_copy_to_va_nocache() helper
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 <linyunsheng@...wei.com>
---
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
Powered by blists - more mailing lists