]> git.baikalelectronics.ru Git - kernel.git/commit
sock: skb_copy_ubufs support for compound pages
authorWillem de Bruijn <willemb@google.com>
Thu, 3 Aug 2017 20:29:38 +0000 (16:29 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Aug 2017 04:37:29 +0000 (21:37 -0700)
commiteae0e056ed451450baeb1c1dcbc8074770152cdb
treec18f48b0b880177bd081d3f365ce296b6f96f777
parent8661c6833524fab1b85dd36881a66e3e9595a05c
sock: skb_copy_ubufs support for compound pages

Refine skb_copy_ubufs to support compound pages. With upcoming TCP
zerocopy sendmsg, such fragments may appear.

The existing code replaces each page one for one. Splitting each
compound page into an independent number of regular pages can result
in exceeding limit MAX_SKB_FRAGS if data is not exactly page aligned.

Instead, fill all destination pages but the last to PAGE_SIZE.
Split the existing alloc + copy loop into separate stages:
1. compute bytelength and minimum number of pages to store this.
2. allocate
3. copy, filling each page except the last to PAGE_SIZE bytes
4. update skb frag array

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/core/skbuff.c