mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: introduce and use skb_frag_fill_page_desc()
Most users use __skb_frag_set_page()/skb_frag_off_set()/ skb_frag_size_set() to fill the page desc for a skb frag. Introduce skb_frag_fill_page_desc() to do that. net/bpf/test_run.c does not call skb_frag_off_set() to set the offset, "copy_from_user(page_address(page), ...)" and 'shinfo' being part of the 'data' kzalloced in bpf_test_init() suggest that it is assuming offset to be initialized as zero, so call skb_frag_fill_page_desc() with offset being zero for this case. Also, skb_frag_set_page() is not used anymore, so remove it. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
305c041899
commit
b51f4113eb
@@ -1272,9 +1272,7 @@ static int virtnet_build_xdp_buff_mrg(struct net_device *dev,
|
||||
}
|
||||
|
||||
frag = &shinfo->frags[shinfo->nr_frags++];
|
||||
__skb_frag_set_page(frag, page);
|
||||
skb_frag_off_set(frag, offset);
|
||||
skb_frag_size_set(frag, len);
|
||||
skb_frag_fill_page_desc(frag, page, offset, len);
|
||||
if (page_is_pfmemalloc(page))
|
||||
xdp_buff_set_frag_pfmemalloc(xdp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user