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