13 #include <linux/module.h>
18 #include <linux/slab.h>
25 #define VHOST_TEST_WEIGHT 0x80000
63 if (head == vq->
num) {
71 vq_err(vq,
"Unexpected descriptor format for TX: "
72 "out %d, int %d\n", out, in);
75 len = iov_length(vq->
iov, out);
78 vq_err(vq,
"Unexpected 0 len for TX\n");
123 static void *vhost_test_stop_vq(
struct vhost_test *n,
130 lockdep_is_held(&vq->
mutex));
136 static void vhost_test_stop(
struct vhost_test *n,
void **privatep)
146 static void vhost_test_flush(
struct vhost_test *n)
151 static int vhost_test_release(
struct inode *inode,
struct file *f)
156 vhost_test_stop(n, &
private);
168 void *
priv, *oldpriv;
172 if (test < 0 || test > 1)
180 for (index = 0; index < n->
dev.nvqs; ++
index) {
188 for (index = 0; index < n->
dev.nvqs; ++
index) {
191 priv = test ? n :
NULL;
195 lockdep_is_held(&vq->
mutex));
206 vhost_test_flush_vq(n, index);
218 static long vhost_test_reset_owner(
struct vhost_test *n)
226 vhost_test_stop(n, &priv);
249 static long vhost_test_ioctl(
struct file *f,
unsigned int ioctl,
262 return vhost_test_run(n, test);
273 return vhost_test_set_features(n, features);
275 return vhost_test_reset_owner(n);
286 static long vhost_test_compat_ioctl(
struct file *f,
unsigned int ioctl,
289 return vhost_test_ioctl(f, ioctl, (
unsigned long)compat_ptr(arg));
295 .release = vhost_test_release,
296 .unlocked_ioctl = vhost_test_ioctl,
298 .compat_ioctl = vhost_test_compat_ioctl,
300 .open = vhost_test_open,
310 static int vhost_test_init(
void)
316 static void vhost_test_exit(
void)