blob: 526290d8c12c190bce60fb47e290d0698344d829 [file] [log] [blame]
Nikolay Nikolaevd314f582014-05-27 15:06:29 +03001/*
2 * vhost-user.c
3 *
4 * Copyright (c) 2013 Virtual Open Systems Sarl.
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 *
9 */
10
Peter Maydell2744d922016-01-29 17:50:00 +000011#include "qemu/osdep.h"
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030012#include "clients.h"
13#include "net/vhost_net.h"
14#include "net/vhost-user.h"
Marc-André Lureau4d43a602017-01-26 18:26:44 +040015#include "chardev/char-fe.h"
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +030016#include "qemu/config-file.h"
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030017#include "qemu/error-report.h"
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080018#include "qmp-commands.h"
Marc-André Lureau69b32a62015-10-09 17:17:30 +020019#include "trace.h"
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030020
21typedef struct VhostUserState {
22 NetClientState nc;
Marc-André Lureau5d300162016-10-22 12:52:57 +030023 CharBackend chr; /* only queue index 0 */
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030024 VHostNetState *vhost_net;
Paolo Bonzini6f1de6b2016-06-20 15:02:40 +020025 guint watch;
Marc-André Lureaua4632152016-06-06 18:45:05 +020026 uint64_t acked_features;
Marc-André Lureauc89804d2016-07-27 01:15:19 +040027 bool started;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030028} VhostUserState;
29
30VHostNetState *vhost_user_get_vhost_net(NetClientState *nc)
31{
32 VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
Eric Blakef394b2e2016-07-13 21:50:23 -060033 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030034 return s->vhost_net;
35}
36
Marc-André Lureaua4632152016-06-06 18:45:05 +020037uint64_t vhost_user_get_acked_features(NetClientState *nc)
38{
39 VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
Eric Blakef394b2e2016-07-13 21:50:23 -060040 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Marc-André Lureaua4632152016-06-06 18:45:05 +020041 return s->acked_features;
42}
43
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080044static void vhost_user_stop(int queues, NetClientState *ncs[])
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030045{
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080046 VhostUserState *s;
47 int i;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030048
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080049 for (i = 0; i < queues; i++) {
Eric Blakef394b2e2016-07-13 21:50:23 -060050 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080051
52 s = DO_UPCAST(VhostUserState, nc, ncs[i]);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080053
54 if (s->vhost_net) {
Marc-André Lureaua4632152016-06-06 18:45:05 +020055 /* save acked features */
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +040056 uint64_t features = vhost_net_get_acked_features(s->vhost_net);
57 if (features) {
58 s->acked_features = features;
59 }
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080060 vhost_net_cleanup(s->vhost_net);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080061 }
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030062 }
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030063}
64
Marc-André Lureau5d300162016-10-22 12:52:57 +030065static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
Nikolay Nikolaevd314f582014-05-27 15:06:29 +030066{
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080067 VhostNetOptions options;
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +040068 struct vhost_net *net = NULL;
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080069 VhostUserState *s;
70 int max_queues;
71 int i;
72
73 options.backend_type = VHOST_BACKEND_TYPE_USER;
74
75 for (i = 0; i < queues; i++) {
Eric Blakef394b2e2016-07-13 21:50:23 -060076 assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080077
78 s = DO_UPCAST(VhostUserState, nc, ncs[i]);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080079
80 options.net_backend = ncs[i];
Marc-André Lureau5d300162016-10-22 12:52:57 +030081 options.opaque = be;
Jason Wang69e87b32016-07-06 09:57:55 +080082 options.busyloop_timeout = 0;
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +040083 net = vhost_net_init(&options);
84 if (!net) {
Markus Armbruster9af9e0f2015-12-18 16:35:19 +010085 error_report("failed to init vhost_net for queue %d", i);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080086 goto err;
87 }
88
89 if (i == 0) {
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +040090 max_queues = vhost_net_get_max_queues(net);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080091 if (queues > max_queues) {
Markus Armbruster9af9e0f2015-12-18 16:35:19 +010092 error_report("you are asking more queues than supported: %d",
93 max_queues);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +080094 goto err;
95 }
96 }
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +040097
98 if (s->vhost_net) {
99 vhost_net_cleanup(s->vhost_net);
100 g_free(s->vhost_net);
101 }
102 s->vhost_net = net;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300103 }
104
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800105 return 0;
106
107err:
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +0400108 if (net) {
109 vhost_net_cleanup(net);
110 }
111 vhost_user_stop(i, ncs);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800112 return -1;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300113}
114
Thibaut Colletf6f56292015-10-09 17:17:31 +0200115static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
116 size_t size)
117{
Thibaut Collet3e866362015-10-09 17:17:32 +0200118 /* In case of RARP (message size is 60) notify backup to send a fake RARP.
119 This fake RARP will be sent by backend only for guest
120 without GUEST_ANNOUNCE capability.
Thibaut Colletf6f56292015-10-09 17:17:31 +0200121 */
Thibaut Collet3e866362015-10-09 17:17:32 +0200122 if (size == 60) {
123 VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
124 int r;
125 static int display_rarp_failure = 1;
126 char mac_addr[6];
127
128 /* extract guest mac address from the RARP message */
129 memcpy(mac_addr, &buf[6], 6);
130
131 r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
132
133 if ((r != 0) && (display_rarp_failure)) {
134 fprintf(stderr,
135 "Vhost user backend fails to broadcast fake RARP\n");
136 fflush(stderr);
137 display_rarp_failure = 0;
138 }
139 }
140
Thibaut Colletf6f56292015-10-09 17:17:31 +0200141 return size;
142}
143
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300144static void vhost_user_cleanup(NetClientState *nc)
145{
146 VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
147
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800148 if (s->vhost_net) {
149 vhost_net_cleanup(s->vhost_net);
Marc-André Lureaue6bcb1b2016-07-27 01:15:12 +0400150 g_free(s->vhost_net);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800151 s->vhost_net = NULL;
152 }
Marc-André Lureauc39860e2016-10-22 12:52:58 +0300153 if (nc->queue_index == 0) {
Marc-André Lureaue0b283e2017-01-24 23:02:58 +0400154 Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
155
Marc-André Lureauc39860e2016-10-22 12:52:58 +0300156 qemu_chr_fe_deinit(&s->chr);
Marc-André Lureau2f5d45a2016-12-14 15:23:36 +0300157 object_unparent(OBJECT(chr));
Paolo Bonzini25f0d2a2016-06-29 15:15:33 +0200158 }
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800159
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300160 qemu_purge_queued_packets(nc);
161}
162
163static bool vhost_user_has_vnet_hdr(NetClientState *nc)
164{
Eric Blakef394b2e2016-07-13 21:50:23 -0600165 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300166
167 return true;
168}
169
170static bool vhost_user_has_ufo(NetClientState *nc)
171{
Eric Blakef394b2e2016-07-13 21:50:23 -0600172 assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300173
174 return true;
175}
176
177static NetClientInfo net_vhost_user_info = {
Eric Blakef394b2e2016-07-13 21:50:23 -0600178 .type = NET_CLIENT_DRIVER_VHOST_USER,
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300179 .size = sizeof(VhostUserState),
Thibaut Colletf6f56292015-10-09 17:17:31 +0200180 .receive = vhost_user_receive,
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300181 .cleanup = vhost_user_cleanup,
182 .has_vnet_hdr = vhost_user_has_vnet_hdr,
183 .has_ufo = vhost_user_has_ufo,
184};
185
Tetsuya Mukawaa6553592016-06-06 18:44:59 +0200186static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
187 void *opaque)
188{
189 VhostUserState *s = opaque;
Tetsuya Mukawaa6553592016-06-06 18:44:59 +0200190
Marc-André Lureau5345fdb2016-10-22 12:52:55 +0300191 qemu_chr_fe_disconnect(&s->chr);
Tetsuya Mukawaa6553592016-06-06 18:44:59 +0200192
Marc-André Lureaue7c83a82017-02-27 14:49:56 +0400193 return TRUE;
194}
195
196static void net_vhost_user_event(void *opaque, int event);
197
198static void chr_closed_bh(void *opaque)
199{
200 const char *name = opaque;
201 NetClientState *ncs[MAX_QUEUE_NUM];
202 VhostUserState *s;
203 Error *err = NULL;
204 int queues;
205
206 queues = qemu_find_net_clients_except(name, ncs,
207 NET_CLIENT_DRIVER_NIC,
208 MAX_QUEUE_NUM);
209 assert(queues < MAX_QUEUE_NUM);
210
211 s = DO_UPCAST(VhostUserState, nc, ncs[0]);
212
213 qmp_set_link(name, false, &err);
214 vhost_user_stop(queues, ncs);
215
216 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,
217 opaque, NULL, true);
218
219 if (err) {
220 error_report_err(err);
221 }
Tetsuya Mukawaa6553592016-06-06 18:44:59 +0200222}
223
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300224static void net_vhost_user_event(void *opaque, int event)
225{
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800226 const char *name = opaque;
227 NetClientState *ncs[MAX_QUEUE_NUM];
228 VhostUserState *s;
Marc-André Lureau0ec7b3e2016-12-07 16:20:22 +0300229 Chardev *chr;
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800230 Error *err = NULL;
231 int queues;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300232
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800233 queues = qemu_find_net_clients_except(name, ncs,
Eric Blakef394b2e2016-07-13 21:50:23 -0600234 NET_CLIENT_DRIVER_NIC,
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800235 MAX_QUEUE_NUM);
Marc-André Lureauc1bf3532016-02-23 19:10:49 +0100236 assert(queues < MAX_QUEUE_NUM);
237
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800238 s = DO_UPCAST(VhostUserState, nc, ncs[0]);
Marc-André Lureau5345fdb2016-10-22 12:52:55 +0300239 chr = qemu_chr_fe_get_driver(&s->chr);
240 trace_vhost_user_event(chr->label, event);
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300241 switch (event) {
242 case CHR_EVENT_OPENED:
Marc-André Lureau5d300162016-10-22 12:52:57 +0300243 if (vhost_user_start(queues, ncs, &s->chr) < 0) {
Marc-André Lureau5345fdb2016-10-22 12:52:55 +0300244 qemu_chr_fe_disconnect(&s->chr);
Marc-André Lureau0d572af2016-06-06 18:45:03 +0200245 return;
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800246 }
Marc-André Lureaue7c83a82017-02-27 14:49:56 +0400247 s->watch = qemu_chr_fe_add_watch(&s->chr, G_IO_HUP,
248 net_vhost_user_watch, s);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800249 qmp_set_link(name, true, &err);
Marc-André Lureauc89804d2016-07-27 01:15:19 +0400250 s->started = true;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300251 break;
252 case CHR_EVENT_CLOSED:
Marc-André Lureaue7c83a82017-02-27 14:49:56 +0400253 /* a close event may happen during a read/write, but vhost
254 * code assumes the vhost_dev remains setup, so delay the
255 * stop & clear to idle.
256 * FIXME: better handle failure in vhost code, remove bh
257 */
258 if (s->watch) {
259 AioContext *ctx = qemu_get_current_aio_context();
260
261 g_source_remove(s->watch);
262 s->watch = 0;
263 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL,
264 NULL, NULL, false);
265
266 aio_bh_schedule_oneshot(ctx, chr_closed_bh, opaque);
267 }
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300268 break;
269 }
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800270
271 if (err) {
272 error_report_err(err);
273 }
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300274}
275
276static int net_vhost_user_init(NetClientState *peer, const char *device,
Marc-André Lureau0ec7b3e2016-12-07 16:20:22 +0300277 const char *name, Chardev *chr,
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800278 int queues)
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300279{
Marc-André Lureau32a6ebe2016-10-22 12:52:52 +0300280 Error *err = NULL;
Marc-André Lureauc89804d2016-07-27 01:15:19 +0400281 NetClientState *nc, *nc0 = NULL;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300282 VhostUserState *s;
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800283 int i;
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300284
Marc-André Lureauc1bf3532016-02-23 19:10:49 +0100285 assert(name);
286 assert(queues > 0);
287
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800288 for (i = 0; i < queues; i++) {
289 nc = qemu_new_net_client(&net_vhost_user_info, peer, device, name);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800290 snprintf(nc->info_str, sizeof(nc->info_str), "vhost-user%d to %s",
291 i, chr->label);
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800292 nc->queue_index = i;
Marc-André Lureau5d300162016-10-22 12:52:57 +0300293 if (!nc0) {
294 nc0 = nc;
295 s = DO_UPCAST(VhostUserState, nc, nc);
296 if (!qemu_chr_fe_init(&s->chr, chr, &err)) {
297 error_report_err(err);
298 return -1;
299 }
Marc-André Lureau32a6ebe2016-10-22 12:52:52 +0300300 }
Marc-André Lureau5d300162016-10-22 12:52:57 +0300301
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800302 }
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300303
Marc-André Lureauc89804d2016-07-27 01:15:19 +0400304 s = DO_UPCAST(VhostUserState, nc, nc0);
305 do {
Marc-André Lureau5345fdb2016-10-22 12:52:55 +0300306 if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) {
Marc-André Lureauc89804d2016-07-27 01:15:19 +0400307 error_report_err(err);
308 return -1;
309 }
Marc-André Lureau5345fdb2016-10-22 12:52:55 +0300310 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL,
Marc-André Lureau39ab61c2016-10-22 12:53:03 +0300311 net_vhost_user_event, nc0->name, NULL, true);
Marc-André Lureauc89804d2016-07-27 01:15:19 +0400312 } while (!s->started);
Michael S. Tsirkind345ed22015-07-15 13:47:31 +0300313
Marc-André Lureau1a5b68c2016-07-27 01:15:13 +0400314 assert(s->vhost_net);
315
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300316 return 0;
317}
318
Marc-André Lureau0ec7b3e2016-12-07 16:20:22 +0300319static Chardev *net_vhost_claim_chardev(
Markus Armbruster81904832015-03-13 14:17:16 +0100320 const NetdevVhostUserOptions *opts, Error **errp)
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300321{
Marc-André Lureau0ec7b3e2016-12-07 16:20:22 +0300322 Chardev *chr = qemu_chr_find(opts->chardev);
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300323
324 if (chr == NULL) {
Markus Armbruster81904832015-03-13 14:17:16 +0100325 error_setg(errp, "chardev \"%s\" not found", opts->chardev);
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300326 return NULL;
327 }
328
Daniel P. Berrange0a733362016-10-07 13:18:34 +0100329 if (!qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_RECONNECTABLE)) {
330 error_setg(errp, "chardev \"%s\" is not reconnectable",
331 opts->chardev);
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300332 return NULL;
333 }
Daniel P. Berrange0a733362016-10-07 13:18:34 +0100334 if (!qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_FD_PASS)) {
335 error_setg(errp, "chardev \"%s\" does not support FD passing",
Markus Armbruster81904832015-03-13 14:17:16 +0100336 opts->chardev);
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300337 return NULL;
338 }
339
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300340 return chr;
341}
342
Markus Armbruster28d0de72015-03-13 13:35:14 +0100343static int net_vhost_check_net(void *opaque, QemuOpts *opts, Error **errp)
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300344{
345 const char *name = opaque;
346 const char *driver, *netdev;
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300347
348 driver = qemu_opt_get(opts, "driver");
349 netdev = qemu_opt_get(opts, "netdev");
350
351 if (!driver || !netdev) {
352 return 0;
353 }
354
355 if (strcmp(netdev, name) == 0 &&
Marc-André Lureaud9d26112016-07-27 01:14:56 +0400356 !g_str_has_prefix(driver, "virtio-net-")) {
Markus Armbruster81904832015-03-13 14:17:16 +0100357 error_setg(errp, "vhost-user requires frontend driver virtio-net-*");
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300358 return -1;
359 }
360
361 return 0;
362}
363
Kővágó, Zoltáncebea512016-07-13 21:50:12 -0600364int net_init_vhost_user(const Netdev *netdev, const char *name,
Markus Armbrustera30ecde2015-05-15 13:58:50 +0200365 NetClientState *peer, Error **errp)
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300366{
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800367 int queues;
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300368 const NetdevVhostUserOptions *vhost_user_opts;
Marc-André Lureau0ec7b3e2016-12-07 16:20:22 +0300369 Chardev *chr;
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300370
Eric Blakef394b2e2016-07-13 21:50:23 -0600371 assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER);
372 vhost_user_opts = &netdev->u.vhost_user;
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300373
Daniel P. Berrange0a733362016-10-07 13:18:34 +0100374 chr = net_vhost_claim_chardev(vhost_user_opts, errp);
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300375 if (!chr) {
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300376 return -1;
377 }
378
379 /* verify net frontend */
380 if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,
Markus Armbruster81904832015-03-13 14:17:16 +0100381 (char *)name, errp)) {
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300382 return -1;
383 }
384
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800385 queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1;
Ilya Maximetsfff4e482016-02-24 13:44:34 +0300386 if (queues < 1 || queues > MAX_QUEUE_NUM) {
Victor Kaplansky6f6f9512015-12-01 15:32:26 +0200387 error_setg(errp,
Ilya Maximetsfff4e482016-02-24 13:44:34 +0300388 "vhost-user number of queues must be in range [1, %d]",
389 MAX_QUEUE_NUM);
Victor Kaplansky6f6f9512015-12-01 15:32:26 +0200390 return -1;
391 }
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +0300392
Changchun Ouyangb931bfb2015-09-23 12:20:00 +0800393 return net_vhost_user_init(peer, "vhost_user", name, chr, queues);
Nikolay Nikolaevd314f582014-05-27 15:06:29 +0300394}