]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - net/vmw_vsock/virtio_transport.c
Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi into...
[mirror_ubuntu-artful-kernel.git] / net / vmw_vsock / virtio_transport.c
CommitLineData
0ea9e1d3
AH
1/*
2 * virtio transport for vsock
3 *
4 * Copyright (C) 2013-2015 Red Hat, Inc.
5 * Author: Asias He <asias@redhat.com>
6 * Stefan Hajnoczi <stefanha@redhat.com>
7 *
8 * Some of the code is take from Gerd Hoffmann <kraxel@redhat.com>'s
9 * early virtio-vsock proof-of-concept bits.
10 *
11 * This work is licensed under the terms of the GNU GPL, version 2.
12 */
13#include <linux/spinlock.h>
14#include <linux/module.h>
15#include <linux/list.h>
16#include <linux/atomic.h>
17#include <linux/virtio.h>
18#include <linux/virtio_ids.h>
19#include <linux/virtio_config.h>
20#include <linux/virtio_vsock.h>
21#include <net/sock.h>
22#include <linux/mutex.h>
23#include <net/af_vsock.h>
24
25static struct workqueue_struct *virtio_vsock_workqueue;
26static struct virtio_vsock *the_virtio_vsock;
27static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
28
29struct virtio_vsock {
30 struct virtio_device *vdev;
31 struct virtqueue *vqs[VSOCK_VQ_MAX];
32
33 /* Virtqueue processing is deferred to a workqueue */
34 struct work_struct tx_work;
35 struct work_struct rx_work;
36 struct work_struct event_work;
37
38 /* The following fields are protected by tx_lock. vqs[VSOCK_VQ_TX]
39 * must be accessed with tx_lock held.
40 */
41 struct mutex tx_lock;
42
43 struct work_struct send_pkt_work;
44 spinlock_t send_pkt_list_lock;
45 struct list_head send_pkt_list;
46
b9116823
SH
47 struct work_struct loopback_work;
48 spinlock_t loopback_list_lock; /* protects loopback_list */
49 struct list_head loopback_list;
50
0ea9e1d3
AH
51 atomic_t queued_replies;
52
53 /* The following fields are protected by rx_lock. vqs[VSOCK_VQ_RX]
54 * must be accessed with rx_lock held.
55 */
56 struct mutex rx_lock;
57 int rx_buf_nr;
58 int rx_buf_max_nr;
59
60 /* The following fields are protected by event_lock.
61 * vqs[VSOCK_VQ_EVENT] must be accessed with event_lock held.
62 */
63 struct mutex event_lock;
64 struct virtio_vsock_event event_list[8];
65
66 u32 guest_cid;
67};
68
69static struct virtio_vsock *virtio_vsock_get(void)
70{
71 return the_virtio_vsock;
72}
73
74static u32 virtio_transport_get_local_cid(void)
75{
76 struct virtio_vsock *vsock = virtio_vsock_get();
77
78 return vsock->guest_cid;
79}
80
b9116823
SH
81static void virtio_transport_loopback_work(struct work_struct *work)
82{
83 struct virtio_vsock *vsock =
84 container_of(work, struct virtio_vsock, loopback_work);
85 LIST_HEAD(pkts);
86
87 spin_lock_bh(&vsock->loopback_list_lock);
88 list_splice_init(&vsock->loopback_list, &pkts);
89 spin_unlock_bh(&vsock->loopback_list_lock);
90
91 mutex_lock(&vsock->rx_lock);
92 while (!list_empty(&pkts)) {
93 struct virtio_vsock_pkt *pkt;
94
95 pkt = list_first_entry(&pkts, struct virtio_vsock_pkt, list);
96 list_del_init(&pkt->list);
97
98 virtio_transport_recv_pkt(pkt);
99 }
100 mutex_unlock(&vsock->rx_lock);
101}
102
103static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock,
104 struct virtio_vsock_pkt *pkt)
105{
106 int len = pkt->len;
107
108 spin_lock_bh(&vsock->loopback_list_lock);
109 list_add_tail(&pkt->list, &vsock->loopback_list);
110 spin_unlock_bh(&vsock->loopback_list_lock);
111
112 queue_work(virtio_vsock_workqueue, &vsock->loopback_work);
113
114 return len;
115}
116
0ea9e1d3
AH
117static void
118virtio_transport_send_pkt_work(struct work_struct *work)
119{
120 struct virtio_vsock *vsock =
121 container_of(work, struct virtio_vsock, send_pkt_work);
122 struct virtqueue *vq;
123 bool added = false;
124 bool restart_rx = false;
125
126 mutex_lock(&vsock->tx_lock);
127
128 vq = vsock->vqs[VSOCK_VQ_TX];
129
0ea9e1d3
AH
130 for (;;) {
131 struct virtio_vsock_pkt *pkt;
132 struct scatterlist hdr, buf, *sgs[2];
133 int ret, in_sg = 0, out_sg = 0;
134 bool reply;
135
136 spin_lock_bh(&vsock->send_pkt_list_lock);
137 if (list_empty(&vsock->send_pkt_list)) {
138 spin_unlock_bh(&vsock->send_pkt_list_lock);
0ea9e1d3
AH
139 break;
140 }
141
142 pkt = list_first_entry(&vsock->send_pkt_list,
143 struct virtio_vsock_pkt, list);
144 list_del_init(&pkt->list);
145 spin_unlock_bh(&vsock->send_pkt_list_lock);
146
147 reply = pkt->reply;
148
149 sg_init_one(&hdr, &pkt->hdr, sizeof(pkt->hdr));
150 sgs[out_sg++] = &hdr;
151 if (pkt->buf) {
152 sg_init_one(&buf, pkt->buf, pkt->len);
153 sgs[out_sg++] = &buf;
154 }
155
156 ret = virtqueue_add_sgs(vq, sgs, out_sg, in_sg, pkt, GFP_KERNEL);
21bc54fc
GG
157 /* Usually this means that there is no more space available in
158 * the vq
159 */
0ea9e1d3
AH
160 if (ret < 0) {
161 spin_lock_bh(&vsock->send_pkt_list_lock);
162 list_add(&pkt->list, &vsock->send_pkt_list);
163 spin_unlock_bh(&vsock->send_pkt_list_lock);
0ea9e1d3
AH
164 break;
165 }
166
167 if (reply) {
168 struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX];
169 int val;
170
171 val = atomic_dec_return(&vsock->queued_replies);
172
173 /* Do we now have resources to resume rx processing? */
174 if (val + 1 == virtqueue_get_vring_size(rx_vq))
175 restart_rx = true;
176 }
177
178 added = true;
179 }
180
181 if (added)
182 virtqueue_kick(vq);
183
184 mutex_unlock(&vsock->tx_lock);
185
186 if (restart_rx)
187 queue_work(virtio_vsock_workqueue, &vsock->rx_work);
188}
189
190static int
191virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt)
192{
193 struct virtio_vsock *vsock;
194 int len = pkt->len;
195
196 vsock = virtio_vsock_get();
197 if (!vsock) {
198 virtio_transport_free_pkt(pkt);
199 return -ENODEV;
200 }
201
b9116823
SH
202 if (le32_to_cpu(pkt->hdr.dst_cid) == vsock->guest_cid)
203 return virtio_transport_send_pkt_loopback(vsock, pkt);
204
0ea9e1d3
AH
205 if (pkt->reply)
206 atomic_inc(&vsock->queued_replies);
207
208 spin_lock_bh(&vsock->send_pkt_list_lock);
209 list_add_tail(&pkt->list, &vsock->send_pkt_list);
210 spin_unlock_bh(&vsock->send_pkt_list_lock);
211
212 queue_work(virtio_vsock_workqueue, &vsock->send_pkt_work);
213 return len;
214}
215
216static void virtio_vsock_rx_fill(struct virtio_vsock *vsock)
217{
218 int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE;
219 struct virtio_vsock_pkt *pkt;
220 struct scatterlist hdr, buf, *sgs[2];
221 struct virtqueue *vq;
222 int ret;
223
224 vq = vsock->vqs[VSOCK_VQ_RX];
225
226 do {
227 pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
228 if (!pkt)
229 break;
230
231 pkt->buf = kmalloc(buf_len, GFP_KERNEL);
232 if (!pkt->buf) {
233 virtio_transport_free_pkt(pkt);
234 break;
235 }
236
237 pkt->len = buf_len;
238
239 sg_init_one(&hdr, &pkt->hdr, sizeof(pkt->hdr));
240 sgs[0] = &hdr;
241
242 sg_init_one(&buf, pkt->buf, buf_len);
243 sgs[1] = &buf;
244 ret = virtqueue_add_sgs(vq, sgs, 0, 2, pkt, GFP_KERNEL);
245 if (ret) {
246 virtio_transport_free_pkt(pkt);
247 break;
248 }
249 vsock->rx_buf_nr++;
250 } while (vq->num_free);
251 if (vsock->rx_buf_nr > vsock->rx_buf_max_nr)
252 vsock->rx_buf_max_nr = vsock->rx_buf_nr;
253 virtqueue_kick(vq);
254}
255
256static void virtio_transport_tx_work(struct work_struct *work)
257{
258 struct virtio_vsock *vsock =
259 container_of(work, struct virtio_vsock, tx_work);
260 struct virtqueue *vq;
261 bool added = false;
262
263 vq = vsock->vqs[VSOCK_VQ_TX];
264 mutex_lock(&vsock->tx_lock);
265 do {
266 struct virtio_vsock_pkt *pkt;
267 unsigned int len;
268
269 virtqueue_disable_cb(vq);
270 while ((pkt = virtqueue_get_buf(vq, &len)) != NULL) {
271 virtio_transport_free_pkt(pkt);
272 added = true;
273 }
274 } while (!virtqueue_enable_cb(vq));
275 mutex_unlock(&vsock->tx_lock);
276
277 if (added)
278 queue_work(virtio_vsock_workqueue, &vsock->send_pkt_work);
279}
280
281/* Is there space left for replies to rx packets? */
282static bool virtio_transport_more_replies(struct virtio_vsock *vsock)
283{
284 struct virtqueue *vq = vsock->vqs[VSOCK_VQ_RX];
285 int val;
286
287 smp_rmb(); /* paired with atomic_inc() and atomic_dec_return() */
288 val = atomic_read(&vsock->queued_replies);
289
290 return val < virtqueue_get_vring_size(vq);
291}
292
293static void virtio_transport_rx_work(struct work_struct *work)
294{
295 struct virtio_vsock *vsock =
296 container_of(work, struct virtio_vsock, rx_work);
297 struct virtqueue *vq;
298
299 vq = vsock->vqs[VSOCK_VQ_RX];
300
301 mutex_lock(&vsock->rx_lock);
302
303 do {
304 virtqueue_disable_cb(vq);
305 for (;;) {
306 struct virtio_vsock_pkt *pkt;
307 unsigned int len;
308
309 if (!virtio_transport_more_replies(vsock)) {
310 /* Stop rx until the device processes already
311 * pending replies. Leave rx virtqueue
312 * callbacks disabled.
313 */
314 goto out;
315 }
316
317 pkt = virtqueue_get_buf(vq, &len);
318 if (!pkt) {
319 break;
320 }
321
322 vsock->rx_buf_nr--;
323
324 /* Drop short/long packets */
325 if (unlikely(len < sizeof(pkt->hdr) ||
326 len > sizeof(pkt->hdr) + pkt->len)) {
327 virtio_transport_free_pkt(pkt);
328 continue;
329 }
330
331 pkt->len = len - sizeof(pkt->hdr);
332 virtio_transport_recv_pkt(pkt);
333 }
334 } while (!virtqueue_enable_cb(vq));
335
336out:
337 if (vsock->rx_buf_nr < vsock->rx_buf_max_nr / 2)
338 virtio_vsock_rx_fill(vsock);
339 mutex_unlock(&vsock->rx_lock);
340}
341
342/* event_lock must be held */
343static int virtio_vsock_event_fill_one(struct virtio_vsock *vsock,
344 struct virtio_vsock_event *event)
345{
346 struct scatterlist sg;
347 struct virtqueue *vq;
348
349 vq = vsock->vqs[VSOCK_VQ_EVENT];
350
351 sg_init_one(&sg, event, sizeof(*event));
352
353 return virtqueue_add_inbuf(vq, &sg, 1, event, GFP_KERNEL);
354}
355
356/* event_lock must be held */
357static void virtio_vsock_event_fill(struct virtio_vsock *vsock)
358{
359 size_t i;
360
361 for (i = 0; i < ARRAY_SIZE(vsock->event_list); i++) {
362 struct virtio_vsock_event *event = &vsock->event_list[i];
363
364 virtio_vsock_event_fill_one(vsock, event);
365 }
366
367 virtqueue_kick(vsock->vqs[VSOCK_VQ_EVENT]);
368}
369
370static void virtio_vsock_reset_sock(struct sock *sk)
371{
372 lock_sock(sk);
373 sk->sk_state = SS_UNCONNECTED;
374 sk->sk_err = ECONNRESET;
375 sk->sk_error_report(sk);
376 release_sock(sk);
377}
378
379static void virtio_vsock_update_guest_cid(struct virtio_vsock *vsock)
380{
381 struct virtio_device *vdev = vsock->vdev;
6c7efafd 382 __le64 guest_cid;
0ea9e1d3
AH
383
384 vdev->config->get(vdev, offsetof(struct virtio_vsock_config, guest_cid),
385 &guest_cid, sizeof(guest_cid));
386 vsock->guest_cid = le64_to_cpu(guest_cid);
387}
388
389/* event_lock must be held */
390static void virtio_vsock_event_handle(struct virtio_vsock *vsock,
391 struct virtio_vsock_event *event)
392{
393 switch (le32_to_cpu(event->id)) {
394 case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
395 virtio_vsock_update_guest_cid(vsock);
396 vsock_for_each_connected_socket(virtio_vsock_reset_sock);
397 break;
398 }
399}
400
401static void virtio_transport_event_work(struct work_struct *work)
402{
403 struct virtio_vsock *vsock =
404 container_of(work, struct virtio_vsock, event_work);
405 struct virtqueue *vq;
406
407 vq = vsock->vqs[VSOCK_VQ_EVENT];
408
409 mutex_lock(&vsock->event_lock);
410
411 do {
412 struct virtio_vsock_event *event;
413 unsigned int len;
414
415 virtqueue_disable_cb(vq);
416 while ((event = virtqueue_get_buf(vq, &len)) != NULL) {
417 if (len == sizeof(*event))
418 virtio_vsock_event_handle(vsock, event);
419
420 virtio_vsock_event_fill_one(vsock, event);
421 }
422 } while (!virtqueue_enable_cb(vq));
423
424 virtqueue_kick(vsock->vqs[VSOCK_VQ_EVENT]);
425
426 mutex_unlock(&vsock->event_lock);
427}
428
429static void virtio_vsock_event_done(struct virtqueue *vq)
430{
431 struct virtio_vsock *vsock = vq->vdev->priv;
432
433 if (!vsock)
434 return;
435 queue_work(virtio_vsock_workqueue, &vsock->event_work);
436}
437
438static void virtio_vsock_tx_done(struct virtqueue *vq)
439{
440 struct virtio_vsock *vsock = vq->vdev->priv;
441
442 if (!vsock)
443 return;
444 queue_work(virtio_vsock_workqueue, &vsock->tx_work);
445}
446
447static void virtio_vsock_rx_done(struct virtqueue *vq)
448{
449 struct virtio_vsock *vsock = vq->vdev->priv;
450
451 if (!vsock)
452 return;
453 queue_work(virtio_vsock_workqueue, &vsock->rx_work);
454}
455
456static struct virtio_transport virtio_transport = {
457 .transport = {
458 .get_local_cid = virtio_transport_get_local_cid,
459
460 .init = virtio_transport_do_socket_init,
461 .destruct = virtio_transport_destruct,
462 .release = virtio_transport_release,
463 .connect = virtio_transport_connect,
464 .shutdown = virtio_transport_shutdown,
465
466 .dgram_bind = virtio_transport_dgram_bind,
467 .dgram_dequeue = virtio_transport_dgram_dequeue,
468 .dgram_enqueue = virtio_transport_dgram_enqueue,
469 .dgram_allow = virtio_transport_dgram_allow,
470
471 .stream_dequeue = virtio_transport_stream_dequeue,
472 .stream_enqueue = virtio_transport_stream_enqueue,
473 .stream_has_data = virtio_transport_stream_has_data,
474 .stream_has_space = virtio_transport_stream_has_space,
475 .stream_rcvhiwat = virtio_transport_stream_rcvhiwat,
476 .stream_is_active = virtio_transport_stream_is_active,
477 .stream_allow = virtio_transport_stream_allow,
478
479 .notify_poll_in = virtio_transport_notify_poll_in,
480 .notify_poll_out = virtio_transport_notify_poll_out,
481 .notify_recv_init = virtio_transport_notify_recv_init,
482 .notify_recv_pre_block = virtio_transport_notify_recv_pre_block,
483 .notify_recv_pre_dequeue = virtio_transport_notify_recv_pre_dequeue,
484 .notify_recv_post_dequeue = virtio_transport_notify_recv_post_dequeue,
485 .notify_send_init = virtio_transport_notify_send_init,
486 .notify_send_pre_block = virtio_transport_notify_send_pre_block,
487 .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue,
488 .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue,
489
490 .set_buffer_size = virtio_transport_set_buffer_size,
491 .set_min_buffer_size = virtio_transport_set_min_buffer_size,
492 .set_max_buffer_size = virtio_transport_set_max_buffer_size,
493 .get_buffer_size = virtio_transport_get_buffer_size,
494 .get_min_buffer_size = virtio_transport_get_min_buffer_size,
495 .get_max_buffer_size = virtio_transport_get_max_buffer_size,
496 },
497
498 .send_pkt = virtio_transport_send_pkt,
499};
500
501static int virtio_vsock_probe(struct virtio_device *vdev)
502{
503 vq_callback_t *callbacks[] = {
504 virtio_vsock_rx_done,
505 virtio_vsock_tx_done,
506 virtio_vsock_event_done,
507 };
508 static const char * const names[] = {
509 "rx",
510 "tx",
511 "event",
512 };
513 struct virtio_vsock *vsock = NULL;
514 int ret;
515
516 ret = mutex_lock_interruptible(&the_virtio_vsock_mutex);
517 if (ret)
518 return ret;
519
520 /* Only one virtio-vsock device per guest is supported */
521 if (the_virtio_vsock) {
522 ret = -EBUSY;
523 goto out;
524 }
525
526 vsock = kzalloc(sizeof(*vsock), GFP_KERNEL);
527 if (!vsock) {
528 ret = -ENOMEM;
529 goto out;
530 }
531
532 vsock->vdev = vdev;
533
534 ret = vsock->vdev->config->find_vqs(vsock->vdev, VSOCK_VQ_MAX,
fb5e31d9
CH
535 vsock->vqs, callbacks, names,
536 NULL);
0ea9e1d3
AH
537 if (ret < 0)
538 goto out;
539
540 virtio_vsock_update_guest_cid(vsock);
541
542 ret = vsock_core_init(&virtio_transport.transport);
543 if (ret < 0)
544 goto out_vqs;
545
546 vsock->rx_buf_nr = 0;
547 vsock->rx_buf_max_nr = 0;
548 atomic_set(&vsock->queued_replies, 0);
549
550 vdev->priv = vsock;
551 the_virtio_vsock = vsock;
552 mutex_init(&vsock->tx_lock);
553 mutex_init(&vsock->rx_lock);
554 mutex_init(&vsock->event_lock);
555 spin_lock_init(&vsock->send_pkt_list_lock);
556 INIT_LIST_HEAD(&vsock->send_pkt_list);
b9116823
SH
557 spin_lock_init(&vsock->loopback_list_lock);
558 INIT_LIST_HEAD(&vsock->loopback_list);
0ea9e1d3
AH
559 INIT_WORK(&vsock->rx_work, virtio_transport_rx_work);
560 INIT_WORK(&vsock->tx_work, virtio_transport_tx_work);
561 INIT_WORK(&vsock->event_work, virtio_transport_event_work);
562 INIT_WORK(&vsock->send_pkt_work, virtio_transport_send_pkt_work);
b9116823 563 INIT_WORK(&vsock->loopback_work, virtio_transport_loopback_work);
0ea9e1d3
AH
564
565 mutex_lock(&vsock->rx_lock);
566 virtio_vsock_rx_fill(vsock);
567 mutex_unlock(&vsock->rx_lock);
568
569 mutex_lock(&vsock->event_lock);
570 virtio_vsock_event_fill(vsock);
571 mutex_unlock(&vsock->event_lock);
572
573 mutex_unlock(&the_virtio_vsock_mutex);
574 return 0;
575
576out_vqs:
577 vsock->vdev->config->del_vqs(vsock->vdev);
578out:
579 kfree(vsock);
580 mutex_unlock(&the_virtio_vsock_mutex);
581 return ret;
582}
583
584static void virtio_vsock_remove(struct virtio_device *vdev)
585{
586 struct virtio_vsock *vsock = vdev->priv;
587 struct virtio_vsock_pkt *pkt;
588
b9116823 589 flush_work(&vsock->loopback_work);
0ea9e1d3
AH
590 flush_work(&vsock->rx_work);
591 flush_work(&vsock->tx_work);
592 flush_work(&vsock->event_work);
593 flush_work(&vsock->send_pkt_work);
594
595 vdev->config->reset(vdev);
596
597 mutex_lock(&vsock->rx_lock);
598 while ((pkt = virtqueue_detach_unused_buf(vsock->vqs[VSOCK_VQ_RX])))
599 virtio_transport_free_pkt(pkt);
600 mutex_unlock(&vsock->rx_lock);
601
602 mutex_lock(&vsock->tx_lock);
603 while ((pkt = virtqueue_detach_unused_buf(vsock->vqs[VSOCK_VQ_TX])))
604 virtio_transport_free_pkt(pkt);
605 mutex_unlock(&vsock->tx_lock);
606
607 spin_lock_bh(&vsock->send_pkt_list_lock);
608 while (!list_empty(&vsock->send_pkt_list)) {
609 pkt = list_first_entry(&vsock->send_pkt_list,
610 struct virtio_vsock_pkt, list);
611 list_del(&pkt->list);
612 virtio_transport_free_pkt(pkt);
613 }
614 spin_unlock_bh(&vsock->send_pkt_list_lock);
615
b9116823
SH
616 spin_lock_bh(&vsock->loopback_list_lock);
617 while (!list_empty(&vsock->loopback_list)) {
618 pkt = list_first_entry(&vsock->loopback_list,
619 struct virtio_vsock_pkt, list);
620 list_del(&pkt->list);
621 virtio_transport_free_pkt(pkt);
622 }
623 spin_unlock_bh(&vsock->loopback_list_lock);
624
0ea9e1d3
AH
625 mutex_lock(&the_virtio_vsock_mutex);
626 the_virtio_vsock = NULL;
627 vsock_core_exit();
628 mutex_unlock(&the_virtio_vsock_mutex);
629
630 vdev->config->del_vqs(vdev);
631
632 kfree(vsock);
633}
634
635static struct virtio_device_id id_table[] = {
636 { VIRTIO_ID_VSOCK, VIRTIO_DEV_ANY_ID },
637 { 0 },
638};
639
640static unsigned int features[] = {
641};
642
643static struct virtio_driver virtio_vsock_driver = {
644 .feature_table = features,
645 .feature_table_size = ARRAY_SIZE(features),
646 .driver.name = KBUILD_MODNAME,
647 .driver.owner = THIS_MODULE,
648 .id_table = id_table,
649 .probe = virtio_vsock_probe,
650 .remove = virtio_vsock_remove,
651};
652
653static int __init virtio_vsock_init(void)
654{
655 int ret;
656
657 virtio_vsock_workqueue = alloc_workqueue("virtio_vsock", 0, 0);
658 if (!virtio_vsock_workqueue)
659 return -ENOMEM;
660 ret = register_virtio_driver(&virtio_vsock_driver);
661 if (ret)
662 destroy_workqueue(virtio_vsock_workqueue);
663 return ret;
664}
665
666static void __exit virtio_vsock_exit(void)
667{
668 unregister_virtio_driver(&virtio_vsock_driver);
669 destroy_workqueue(virtio_vsock_workqueue);
670}
671
672module_init(virtio_vsock_init);
673module_exit(virtio_vsock_exit);
674MODULE_LICENSE("GPL v2");
675MODULE_AUTHOR("Asias He");
676MODULE_DESCRIPTION("virtio transport for vsock");
677MODULE_DEVICE_TABLE(virtio, id_table);