datagram: open-code copy_page_to_iter
authorSagi Grimberg <sagi@lightbitslabs.com>
Tue, 4 Dec 2018 01:52:06 +0000 (17:52 -0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 13 Dec 2018 08:58:52 +0000 (09:58 +0100)
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 <davem@davemloft.net>
Signed-off-by: Sagi Grimberg <sagi@lightbitslabs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
net/core/datagram.c

index 57f3a6fcfc1e20bf31f2f6cf0abd0b38f9cef5f4..abe642181b649c920e47cb5b765aa877eaadabfc 100644 (file)
@@ -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;