2

I am working on a new socket that sits on top of TCP sockets, and for performance reasons, I want to call tcp_sendpage instead of tcp_sendmsg (tcp_sendmsg would copy my data unnecessarily). However, my input is a kmalloc'ed buffer that can be anywhere from a few bytes to spanning several pages. tcp_sendpage wants a struct page*, offset, and size as input. How do I convert my buffer to something that tcp_sendpage likes to see?

I have discovered virt_to_page and offset_in_page; however, that only converts a single address rather than the entire buffer. In my mind what I need is a function that converts my (physically contiguous, as promised by kmalloc) buffer into an array of pages and offsets

Mathieu
  • 8,840
  • 7
  • 32
  • 45
Lance Chao
  • 79
  • 2
  • 7

0 Answers0