Commit fc02e8cb authored by Michael S. Tsirkin's avatar Michael S. Tsirkin

virtio_net: clarify tailroom logic

Make tailroom math follow same logic as everything else, subtracing
values in the order in which things are laid out in the buffer.
Tested-by: default avatarCorentin Noël <corentin.noel@collabora.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 8bb7eca9
...@@ -406,12 +406,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, ...@@ -406,12 +406,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
* add_recvbuf_mergeable() + get_mergeable_buf_len() * add_recvbuf_mergeable() + get_mergeable_buf_len()
*/ */
truesize = headroom ? PAGE_SIZE : truesize; truesize = headroom ? PAGE_SIZE : truesize;
tailroom = truesize - len - headroom - (hdr_padded_len - hdr_len); tailroom = truesize - headroom;
buf = p - headroom; buf = p - headroom;
len -= hdr_len; len -= hdr_len;
offset += hdr_padded_len; offset += hdr_padded_len;
p += hdr_padded_len; p += hdr_padded_len;
tailroom -= hdr_padded_len + len;
shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
......
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