Thread (13 messages) 13 messages, 2 authors, 2024-08-23

Re: [PATCH net-next v14 09/11] net: replace page_frag with page_frag_cache

From: Simon Horman <horms@kernel.org>
Date: 2024-08-23 17:40:36
Also in: bpf, lkml, mptcp

On Fri, Aug 23, 2024 at 11:00:37PM +0800, Yunsheng Lin wrote:
quoted hunk ↗ jump to hunk
@@ -1114,82 +1104,44 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 			if (err)
 				goto do_fault;
 		} else {
+			struct page_frag_cache *nc = &sk->sk_frag;
+			struct page_frag page_frag, *pfrag;
 			int i = skb_shinfo(skb)->nr_frags;
-			struct page *page = TCP_PAGE(sk);
-			int pg_size = PAGE_SIZE;
-			int off = TCP_OFF(sk);
-			bool merge;
-
-			if (page)
-				pg_size = page_size(page);
-			if (off < pg_size &&
-			    skb_can_coalesce(skb, i, page, off)) {
+			bool merge = false;
+			void *va;
+
+			pfrag = &page_frag;
+			va = page_frag_alloc_refill_prepare(pfrag, 32U, pfrag,
+							    sk->sk_allocation);
Unfortunately this does not seem to compile.

.../chtls_io.c: In function 'chtls_sendmsg':
.../chtls_io.c:1114:61: error: passing argument 1 of 'page_frag_alloc_refill_prepare' from incompatible pointer type [-Wincompatible-pointer-types]
 1114 |                         va = page_frag_alloc_refill_prepare(pfrag, 32U, pfrag,
      |                                                             ^~~~~
      |                                                             |
      |                                                             struct page_frag *
In file included from ./include/linux/skbuff.h:34,
                 from .../chtls_io.c:11:
./include/linux/page_frag_cache.h:205:76: note: expected 'struct page_frag_cache *' but argument is of type 'struct page_frag *'
  205 | static inline void *page_frag_alloc_refill_prepare(struct page_frag_cache *nc,
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~^~

...

-- 
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help