aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2017-10-05 14:24:05 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-10-05 20:08:18 +0000
commit67700d41169ac37d21c400949a316750eabad969 (patch)
treede377e1584d6bd61393cba05c74421a437bcdcd7 /src
parenta5081a7ac3e013febda1b8b61aed1dc9cd8321ef (diff)
fix buffer allocation for sparse jumbo frames in vhost
A bug was reported where a jumbo packet would stay in vhost queue forever or until a large enough number of other packets arrived in the queue too. This is due to a bug in vhost input node buffer allocation. The fix is to make sure that vhost always allocates at least enough buffers for one single big packet. '40' is used to account for 65kB frames. Change-Id: I1d293028854165083e30cd798fab9d4140230b78 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/devices/virtio/vhost-user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/devices/virtio/vhost-user.c b/src/vnet/devices/virtio/vhost-user.c
index 4200ed8d8f3..55faf4f5a66 100644
--- a/src/vnet/devices/virtio/vhost-user.c
+++ b/src/vnet/devices/virtio/vhost-user.c
@@ -1545,8 +1545,10 @@ vhost_user_if_input (vlib_main_t * vm,
* per packet. In case packets are bigger, we will just yeld at some point
* in the loop and come back later. This is not an issue as for big packet,
* processing cost really comes from the memory copy.
+ * The assumption is that big packets will fit in 40 buffers.
*/
- if (PREDICT_FALSE (vum->cpus[thread_index].rx_buffers_len < n_left + 1))
+ if (PREDICT_FALSE (vum->cpus[thread_index].rx_buffers_len < n_left + 1 ||
+ vum->cpus[thread_index].rx_buffers_len < 40))
{
u32 curr_len = vum->cpus[thread_index].rx_buffers_len;
vum->cpus[thread_index].rx_buffers_len +=