Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4575a2d authored by Cody Schuffelen's avatar Cody Schuffelen
Browse files

commit e82b9b0727ff ("vhost: introduce vhost_exceeds_weight()")



Complete backport of vhost_exceeds_weight to android-4.4-p

Test: Compiles
Bug: 143972019
Change-Id: Ifafc3321332d9033be75123e761d7da7d8586e4c
Signed-off-by: default avatarCody Schuffelen <schuffelen@google.com>
parent 903fbe76
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -21,6 +21,14 @@
#include "vhost.h"

#define VHOST_VSOCK_DEFAULT_HOST_CID	2
/* Max number of bytes transferred before requeueing the job.
 * Using this limit prevents one virtqueue from starving others. */
#define VHOST_VSOCK_WEIGHT 0x80000
/* Max number of packets transferred before requeueing the job.
 * Using this limit prevents one virtqueue from starving others with
 * small pkts.
 */
#define VHOST_VSOCK_PKT_WEIGHT 256

enum {
	VHOST_VSOCK_FEATURES = VHOST_FEATURES,
@@ -529,7 +537,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
	vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick;
	vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick;

	vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs));
	vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs),
		       VHOST_VSOCK_PKT_WEIGHT, VHOST_VSOCK_WEIGHT);

	file->private_data = vsock;
	spin_lock_init(&vsock->send_pkt_list_lock);