• Home
  • Raw
  • Download

Lines Matching refs:n

38 static void handle_vq(struct vhost_test *n)  in handle_vq()  argument
40 struct vhost_virtqueue *vq = &n->vqs[VHOST_TEST_VQ]; in handle_vq()
53 vhost_disable_notify(&n->dev, vq); in handle_vq()
65 if (unlikely(vhost_enable_notify(&n->dev, vq))) { in handle_vq()
66 vhost_disable_notify(&n->dev, vq); in handle_vq()
82 vhost_add_used_and_signal(&n->dev, vq, head, 0); in handle_vq()
97 struct vhost_test *n = container_of(vq->dev, struct vhost_test, dev); in handle_vq_kick() local
99 handle_vq(n); in handle_vq_kick()
104 struct vhost_test *n = kmalloc(sizeof *n, GFP_KERNEL); in vhost_test_open() local
108 if (!n) in vhost_test_open()
112 kfree(n); in vhost_test_open()
116 dev = &n->dev; in vhost_test_open()
117 vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ]; in vhost_test_open()
118 n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; in vhost_test_open()
121 f->private_data = n; in vhost_test_open()
126 static void *vhost_test_stop_vq(struct vhost_test *n, in vhost_test_stop_vq() argument
138 static void vhost_test_stop(struct vhost_test *n, void **privatep) in vhost_test_stop() argument
140 *privatep = vhost_test_stop_vq(n, n->vqs + VHOST_TEST_VQ); in vhost_test_stop()
143 static void vhost_test_flush_vq(struct vhost_test *n, int index) in vhost_test_flush_vq() argument
145 vhost_poll_flush(&n->vqs[index].poll); in vhost_test_flush_vq()
148 static void vhost_test_flush(struct vhost_test *n) in vhost_test_flush() argument
150 vhost_test_flush_vq(n, VHOST_TEST_VQ); in vhost_test_flush()
155 struct vhost_test *n = f->private_data; in vhost_test_release() local
158 vhost_test_stop(n, &private); in vhost_test_release()
159 vhost_test_flush(n); in vhost_test_release()
160 vhost_dev_cleanup(&n->dev, false); in vhost_test_release()
163 vhost_test_flush(n); in vhost_test_release()
164 kfree(n); in vhost_test_release()
168 static long vhost_test_run(struct vhost_test *n, int test) in vhost_test_run() argument
177 mutex_lock(&n->dev.mutex); in vhost_test_run()
178 r = vhost_dev_check_owner(&n->dev); in vhost_test_run()
182 for (index = 0; index < n->dev.nvqs; ++index) { in vhost_test_run()
184 if (!vhost_vq_access_ok(&n->vqs[index])) { in vhost_test_run()
190 for (index = 0; index < n->dev.nvqs; ++index) { in vhost_test_run()
191 vq = n->vqs + index; in vhost_test_run()
193 priv = test ? n : NULL; in vhost_test_run()
199 r = vhost_init_used(&n->vqs[index]); in vhost_test_run()
207 vhost_test_flush_vq(n, index); in vhost_test_run()
211 mutex_unlock(&n->dev.mutex); in vhost_test_run()
215 mutex_unlock(&n->dev.mutex); in vhost_test_run()
219 static long vhost_test_reset_owner(struct vhost_test *n) in vhost_test_reset_owner() argument
225 mutex_lock(&n->dev.mutex); in vhost_test_reset_owner()
226 err = vhost_dev_check_owner(&n->dev); in vhost_test_reset_owner()
234 vhost_test_stop(n, &priv); in vhost_test_reset_owner()
235 vhost_test_flush(n); in vhost_test_reset_owner()
236 vhost_dev_reset_owner(&n->dev, memory); in vhost_test_reset_owner()
238 mutex_unlock(&n->dev.mutex); in vhost_test_reset_owner()
242 static int vhost_test_set_features(struct vhost_test *n, u64 features) in vhost_test_set_features() argument
246 mutex_lock(&n->dev.mutex); in vhost_test_set_features()
248 !vhost_log_access_ok(&n->dev)) { in vhost_test_set_features()
249 mutex_unlock(&n->dev.mutex); in vhost_test_set_features()
252 vq = &n->vqs[VHOST_TEST_VQ]; in vhost_test_set_features()
256 mutex_unlock(&n->dev.mutex); in vhost_test_set_features()
263 struct vhost_test *n = f->private_data; in vhost_test_ioctl() local
273 return vhost_test_run(n, test); in vhost_test_ioctl()
284 return vhost_test_set_features(n, features); in vhost_test_ioctl()
286 return vhost_test_reset_owner(n); in vhost_test_ioctl()
288 mutex_lock(&n->dev.mutex); in vhost_test_ioctl()
289 r = vhost_dev_ioctl(&n->dev, ioctl, argp); in vhost_test_ioctl()
291 r = vhost_vring_ioctl(&n->dev, ioctl, argp); in vhost_test_ioctl()
292 vhost_test_flush(n); in vhost_test_ioctl()
293 mutex_unlock(&n->dev.mutex); in vhost_test_ioctl()