Commit d2d30a37 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Paolo Abeni

net: allow skb_datagram_iter to be called from any context

We only use the mapping in a single context, so kmap_local is sufficient
and cheaper. Make sure to use skb_frag_foreach_page as skb frags may
contain compound pages and we need to map page by page.
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202406161539.b5ff7b20-oliver.sang@intel.com
Fixes: 950fcaec ("datagram: consolidate datagram copy to iter helpers")
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Link: https://patch.msgid.link/20240626100008.831849-1-sagi@grimberg.meSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent c93a6f62
...@@ -416,15 +416,22 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, ...@@ -416,15 +416,22 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
end = start + skb_frag_size(frag); end = start + skb_frag_size(frag);
if ((copy = end - offset) > 0) { if ((copy = end - offset) > 0) {
struct page *page = skb_frag_page(frag); u32 p_off, p_len, copied;
u8 *vaddr = kmap(page); struct page *p;
u8 *vaddr;
if (copy > len) if (copy > len)
copy = len; copy = len;
n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
vaddr + skb_frag_off(frag) + offset - start, skb_frag_foreach_page(frag,
copy, data, to); skb_frag_off(frag) + offset - start,
kunmap(page); copy, p, p_off, p_len, copied) {
vaddr = kmap_local_page(p);
n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
vaddr + p_off, p_len, data, to);
kunmap_local(vaddr);
}
offset += n; offset += n;
if (n != copy) if (n != copy)
goto short_copy; goto short_copy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment