Skip to content

Commit f0c3192

Browse files
mstsirkindavem330
authored andcommitted
virtio_net: lower limit on buffer size
commit d85b758 ("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: d85b758 ("virtio_net: fix support for small rings") Reported-by: Mikulas Patocka <[email protected]> Reported-by: "J. Bruce Fields" <[email protected]> Tested-by: Mikulas Patocka <[email protected]> Tested-by: "J. Bruce Fields" <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4bd7ef0 commit f0c3192

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/virtio_net.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
869869
unsigned int len;
870870

871871
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);
873873
return ALIGN(len, L1_CACHE_BYTES);
874874
}
875875

@@ -2144,7 +2144,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
21442144
unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
21452145
unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
21462146

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);
21482149
}
21492150

21502151
static int virtnet_find_vqs(struct virtnet_info *vi)

0 commit comments

Comments
 (0)