lkml.org 
[lkml]   [2024]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net-next v3 09/13] net: introduce the skb_copy_to_va_nocache() helper
Date
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 0450494a1766..57421e680cce 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2196,6 +2196,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

\
 
 \ /
  Last update: 2024-05-08 15:39    [W:0.158 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site