aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2017-06-02 10:54:33 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-02 14:32:34 -0400
commitf0c3192ceee3c16154e70dfb373f66ed86c6fea9 (patch)
treee4185608a31c5dcfe3d9e6ee623dba695073fe5d
parent4bd7ef0b033721b659b9357057e76d1ced95c1da (diff)
virtio_net: lower limit on buffer size
commit d85b758f72b0 ("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: d85b758f72b0 ("virtio_net: fix support for small rings") Reported-by: Mikulas Patocka <mpatocka@redhat.com> Reported-by: "J. Bruce Fields" <bfields@fieldses.org> Tested-by: Mikulas Patocka <mpatocka@redhat.com> Tested-by: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/virtio_net.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 3e9246cc49c3..a871f45ecc79 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -869,7 +869,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
869 unsigned int len; 869 unsigned int len;
870 870
871 len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len), 871 len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
872 rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len); 872 rq->min_buf_len, PAGE_SIZE - hdr_len);
873 return ALIGN(len, L1_CACHE_BYTES); 873 return ALIGN(len, L1_CACHE_BYTES);
874} 874}
875 875
@@ -2144,7 +2144,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
2144 unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len; 2144 unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
2145 unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size); 2145 unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
2146 2146
2147 return max(min_buf_len, hdr_len); 2147 return max(max(min_buf_len, hdr_len) - hdr_len,
2148 (unsigned int)GOOD_PACKET_LEN);
2148} 2149}
2149 2150
2150static int virtnet_find_vqs(struct virtnet_info *vi) 2151static int virtnet_find_vqs(struct virtnet_info *vi)