diff options
author | Jonathan Corbet <corbet@lwn.net> | 2019-06-14 16:18:53 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2019-06-14 16:18:53 -0400 |
commit | 8afecfb0ec961e37e61b2d19c4fa71617a9482de (patch) | |
tree | c43ea51a47b1e76b762caa4c1b0c356249e5e874 /drivers/vhost/vhost.c | |
parent | ce1a5ea18ef9bf4c62c75abe7c540a29264ec988 (diff) | |
parent | d1fdb6d8f6a4109a4263176c84b899076a5f8008 (diff) |
Merge tag 'v5.2-rc4' into mauro
We need to pick up post-rc1 changes to various document files so they don't
get lost in Mauro's massive RST conversion push.
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 69938dbae2d0..31da7db3c1e6 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -413,8 +413,24 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) | |||
413 | vhost_vq_free_iovecs(dev->vqs[i]); | 413 | vhost_vq_free_iovecs(dev->vqs[i]); |
414 | } | 414 | } |
415 | 415 | ||
416 | bool vhost_exceeds_weight(struct vhost_virtqueue *vq, | ||
417 | int pkts, int total_len) | ||
418 | { | ||
419 | struct vhost_dev *dev = vq->dev; | ||
420 | |||
421 | if ((dev->byte_weight && total_len >= dev->byte_weight) || | ||
422 | pkts >= dev->weight) { | ||
423 | vhost_poll_queue(&vq->poll); | ||
424 | return true; | ||
425 | } | ||
426 | |||
427 | return false; | ||
428 | } | ||
429 | EXPORT_SYMBOL_GPL(vhost_exceeds_weight); | ||
430 | |||
416 | void vhost_dev_init(struct vhost_dev *dev, | 431 | void vhost_dev_init(struct vhost_dev *dev, |
417 | struct vhost_virtqueue **vqs, int nvqs, int iov_limit) | 432 | struct vhost_virtqueue **vqs, int nvqs, |
433 | int iov_limit, int weight, int byte_weight) | ||
418 | { | 434 | { |
419 | struct vhost_virtqueue *vq; | 435 | struct vhost_virtqueue *vq; |
420 | int i; | 436 | int i; |
@@ -428,6 +444,8 @@ void vhost_dev_init(struct vhost_dev *dev, | |||
428 | dev->mm = NULL; | 444 | dev->mm = NULL; |
429 | dev->worker = NULL; | 445 | dev->worker = NULL; |
430 | dev->iov_limit = iov_limit; | 446 | dev->iov_limit = iov_limit; |
447 | dev->weight = weight; | ||
448 | dev->byte_weight = byte_weight; | ||
431 | init_llist_head(&dev->work_list); | 449 | init_llist_head(&dev->work_list); |
432 | init_waitqueue_head(&dev->wait); | 450 | init_waitqueue_head(&dev->wait); |
433 | INIT_LIST_HEAD(&dev->read_list); | 451 | INIT_LIST_HEAD(&dev->read_list); |