Skip to content

Commit

Permalink
datagram: open-code copy_page_to_iter
Browse files Browse the repository at this point in the history
This will be useful to consolidate skb_copy_and_hash_datagram_iter and
skb_copy_and_csum_datagram to a single code path.

Acked-by: David S. Miller <[email protected]>
Signed-off-by: Sagi Grimberg <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
Sagi Grimberg authored and Christoph Hellwig committed Dec 13, 2018
1 parent 3152a97 commit 0fc0779
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/core/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,14 @@ int skb_copy_datagram_iter(const struct sk_buff *skb, int offset,

end = start + skb_frag_size(frag);
if ((copy = end - offset) > 0) {
struct page *page = skb_frag_page(frag);
u8 *vaddr = kmap(page);

if (copy > len)
copy = len;
n = copy_page_to_iter(skb_frag_page(frag),
frag->page_offset + offset -
start, copy, to);
n = copy_to_iter(vaddr + frag->page_offset +
offset - start, copy, to);
kunmap(page);
offset += n;
if (n != copy)
goto short_copy;
Expand Down

0 comments on commit 0fc0779

Please sign in to comment.