Commit 53d5fa9b authored by David S. Miller's avatar David S. Miller

Merge branch 'virtio_net-build_skb-fixes'

Xuan Zhuo says:

====================
virtio-net: fix for build_skb()

The logic of this piece is really messy. Fortunately, my refactored patch can be
completed with a small amount of testing.
====================
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents dd9082f4 8fb7da9e
...@@ -401,18 +401,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, ...@@ -401,18 +401,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
/* If headroom is not 0, there is an offset between the beginning of the /* If headroom is not 0, there is an offset between the beginning of the
* data and the allocated space, otherwise the data and the allocated * data and the allocated space, otherwise the data and the allocated
* space are aligned. * space are aligned.
*
* Buffers with headroom use PAGE_SIZE as alloc size, see
* add_recvbuf_mergeable() + get_mergeable_buf_len()
*/ */
if (headroom) { truesize = headroom ? PAGE_SIZE : truesize;
/* Buffers with headroom use PAGE_SIZE as alloc size, tailroom = truesize - len - headroom;
* see add_recvbuf_mergeable() + get_mergeable_buf_len() buf = p - headroom;
*/
truesize = PAGE_SIZE;
tailroom = truesize - len - offset;
buf = page_address(page);
} else {
tailroom = truesize - len;
buf = p;
}
len -= hdr_len; len -= hdr_len;
offset += hdr_padded_len; offset += hdr_padded_len;
...@@ -958,7 +953,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, ...@@ -958,7 +953,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
put_page(page); put_page(page);
head_skb = page_to_skb(vi, rq, xdp_page, offset, head_skb = page_to_skb(vi, rq, xdp_page, offset,
len, PAGE_SIZE, false, len, PAGE_SIZE, false,
metasize, headroom); metasize,
VIRTIO_XDP_HEADROOM);
return head_skb; return head_skb;
} }
break; break;
......
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