Commit f0c3192c authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by David S. Miller

virtio_net: lower limit on buffer size

commit d85b758f ("virtio_net: fix support for small rings")
was supposed to increase the buffer size for small rings but had an
unintentional side effect of decreasing it for large rings. This seems
to break some setups - it's not yet clear why, but increasing buffer
size back to what it was before helps.

Fixes: d85b758f ("virtio_net: fix support for small rings")
Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Reported-by: default avatar"J. Bruce Fields" <bfields@fieldses.org>
Tested-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Tested-by: default avatar"J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4bd7ef0b
No related merge requests found
...@@ -869,7 +869,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq, ...@@ -869,7 +869,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
unsigned int len; unsigned int len;
len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len), len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len); rq->min_buf_len, PAGE_SIZE - hdr_len);
return ALIGN(len, L1_CACHE_BYTES); return ALIGN(len, L1_CACHE_BYTES);
} }
...@@ -2144,7 +2144,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu ...@@ -2144,7 +2144,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len; unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size); unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
return max(min_buf_len, hdr_len); return max(max(min_buf_len, hdr_len) - hdr_len,
(unsigned int)GOOD_PACKET_LEN);
} }
static int virtnet_find_vqs(struct virtnet_info *vi) static int virtnet_find_vqs(struct virtnet_info *vi)
......
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