1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation
9 #include <sys/socket.h>
11 #include <rte_malloc.h>
12 #include <rte_kvargs.h>
13 #include <rte_ethdev_vdev.h>
14 #include <rte_bus_vdev.h>
15 #include <rte_alarm.h>
16 #include <rte_cycles.h>
18 #include "virtio_ethdev.h"
19 #include "virtio_logs.h"
20 #include "virtio_pci.h"
21 #include "virtqueue.h"
22 #include "virtio_rxtx.h"
23 #include "virtio_user/virtio_user_dev.h"
24 #include "virtio_user/vhost.h"
26 #define virtio_user_get_dev(hw) \
27 ((struct virtio_user_dev *)(hw)->virtio_user_dev)
30 virtio_user_reset_queues_packed(struct rte_eth_dev *dev)
32 struct virtio_hw *hw = dev->data->dev_private;
33 struct virtnet_rx *rxvq;
34 struct virtnet_tx *txvq;
37 /* Add lock to avoid queue contention. */
38 rte_spinlock_lock(&hw->state_lock);
42 * Waitting for datapath to complete before resetting queues.
43 * 1 ms should be enough for the ongoing Tx/Rx function to finish.
47 /* Vring reset for each Tx queue and Rx queue. */
48 for (i = 0; i < dev->data->nb_rx_queues; i++) {
49 rxvq = dev->data->rx_queues[i];
50 virtqueue_rxvq_reset_packed(rxvq->vq);
51 virtio_dev_rx_queue_setup_finish(dev, i);
54 for (i = 0; i < dev->data->nb_tx_queues; i++) {
55 txvq = dev->data->tx_queues[i];
56 virtqueue_txvq_reset_packed(txvq->vq);
60 rte_spinlock_unlock(&hw->state_lock);
65 virtio_user_server_reconnect(struct virtio_user_dev *dev)
69 struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id];
70 struct virtio_hw *hw = eth_dev->data->dev_private;
72 connectfd = accept(dev->listenfd, NULL, NULL);
76 dev->vhostfd = connectfd;
77 if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES,
78 &dev->device_features) < 0) {
79 PMD_INIT_LOG(ERR, "get_features failed: %s",
84 dev->device_features |= dev->frontend_features;
86 /* umask vhost-user unsupported features */
87 dev->device_features &= ~(dev->unsupported_features);
89 dev->features &= dev->device_features;
91 /* For packed ring, resetting queues is required in reconnection. */
92 if (vtpci_packed_queue(hw))
93 PMD_INIT_LOG(NOTICE, "Packets on the fly will be dropped"
94 " when packed ring reconnecting.");
95 virtio_user_reset_queues_packed(eth_dev);
97 ret = virtio_user_start_device(dev);
101 if (dev->queue_pairs > 1) {
102 ret = virtio_user_handle_mq(dev, dev->queue_pairs);
104 PMD_INIT_LOG(ERR, "Fails to enable multi-queue pairs!");
108 if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
109 if (rte_intr_disable(eth_dev->intr_handle) < 0) {
110 PMD_DRV_LOG(ERR, "interrupt disable failed");
113 rte_intr_callback_unregister(eth_dev->intr_handle,
114 virtio_interrupt_handler,
116 eth_dev->intr_handle->fd = connectfd;
117 rte_intr_callback_register(eth_dev->intr_handle,
118 virtio_interrupt_handler, eth_dev);
120 if (rte_intr_enable(eth_dev->intr_handle) < 0) {
121 PMD_DRV_LOG(ERR, "interrupt enable failed");
125 PMD_INIT_LOG(NOTICE, "server mode virtio-user reconnection succeeds!");
130 virtio_user_delayed_handler(void *param)
132 struct virtio_hw *hw = (struct virtio_hw *)param;
133 struct rte_eth_dev *eth_dev = &rte_eth_devices[hw->port_id];
134 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
136 if (rte_intr_disable(eth_dev->intr_handle) < 0) {
137 PMD_DRV_LOG(ERR, "interrupt disable failed");
140 rte_intr_callback_unregister(eth_dev->intr_handle,
141 virtio_interrupt_handler, eth_dev);
142 if (dev->is_server) {
143 if (dev->vhostfd >= 0) {
147 eth_dev->intr_handle->fd = dev->listenfd;
148 rte_intr_callback_register(eth_dev->intr_handle,
149 virtio_interrupt_handler, eth_dev);
150 if (rte_intr_enable(eth_dev->intr_handle) < 0) {
151 PMD_DRV_LOG(ERR, "interrupt enable failed");
158 virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset,
159 void *dst, int length)
162 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
164 if (offset == offsetof(struct virtio_net_config, mac) &&
165 length == RTE_ETHER_ADDR_LEN) {
166 for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i)
167 ((uint8_t *)dst)[i] = dev->mac_addr[i];
171 if (offset == offsetof(struct virtio_net_config, status)) {
174 if (dev->vhostfd >= 0) {
178 flags = fcntl(dev->vhostfd, F_GETFL);
179 if (fcntl(dev->vhostfd, F_SETFL,
180 flags | O_NONBLOCK) == -1) {
181 PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag");
184 r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
185 if (r == 0 || (r < 0 && errno != EAGAIN)) {
186 dev->status &= (~VIRTIO_NET_S_LINK_UP);
187 PMD_DRV_LOG(ERR, "virtio-user port %u is down",
190 /* This function could be called in the process
191 * of interrupt handling, callback cannot be
192 * unregistered here, set an alarm to do it.
195 virtio_user_delayed_handler,
198 dev->status |= VIRTIO_NET_S_LINK_UP;
200 if (fcntl(dev->vhostfd, F_SETFL,
201 flags & ~O_NONBLOCK) == -1) {
202 PMD_DRV_LOG(ERR, "error clearing O_NONBLOCK flag");
205 } else if (dev->is_server) {
206 dev->status &= (~VIRTIO_NET_S_LINK_UP);
207 if (virtio_user_server_reconnect(dev) >= 0)
208 dev->status |= VIRTIO_NET_S_LINK_UP;
211 *(uint16_t *)dst = dev->status;
214 if (offset == offsetof(struct virtio_net_config, max_virtqueue_pairs))
215 *(uint16_t *)dst = dev->max_queue_pairs;
219 virtio_user_write_dev_config(struct virtio_hw *hw, size_t offset,
220 const void *src, int length)
223 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
225 if ((offset == offsetof(struct virtio_net_config, mac)) &&
226 (length == RTE_ETHER_ADDR_LEN))
227 for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i)
228 dev->mac_addr[i] = ((const uint8_t *)src)[i];
230 PMD_DRV_LOG(ERR, "not supported offset=%zu, len=%d",
235 virtio_user_reset(struct virtio_hw *hw)
237 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
239 if (dev->status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
240 virtio_user_stop_device(dev);
244 virtio_user_set_status(struct virtio_hw *hw, uint8_t status)
246 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
248 if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
249 virtio_user_start_device(dev);
250 else if (status == VIRTIO_CONFIG_STATUS_RESET)
251 virtio_user_reset(hw);
252 dev->status = status;
256 virtio_user_get_status(struct virtio_hw *hw)
258 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
264 virtio_user_get_features(struct virtio_hw *hw)
266 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
268 /* unmask feature bits defined in vhost user protocol */
269 return dev->device_features & VIRTIO_PMD_SUPPORTED_GUEST_FEATURES;
273 virtio_user_set_features(struct virtio_hw *hw, uint64_t features)
275 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
277 dev->features = features & dev->device_features;
281 virtio_user_get_isr(struct virtio_hw *hw __rte_unused)
283 /* rxq interrupts and config interrupt are separated in virtio-user,
284 * here we only report config change.
286 return VIRTIO_PCI_ISR_CONFIG;
290 virtio_user_set_config_irq(struct virtio_hw *hw __rte_unused,
291 uint16_t vec __rte_unused)
297 virtio_user_set_queue_irq(struct virtio_hw *hw __rte_unused,
298 struct virtqueue *vq __rte_unused,
301 /* pretend we have done that */
305 /* This function is to get the queue size, aka, number of descs, of a specified
306 * queue. Different with the VHOST_USER_GET_QUEUE_NUM, which is used to get the
307 * max supported queues.
310 virtio_user_get_queue_num(struct virtio_hw *hw, uint16_t queue_id __rte_unused)
312 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
314 /* Currently, each queue has same queue size */
315 return dev->queue_size;
319 virtio_user_setup_queue_packed(struct virtqueue *vq,
320 struct virtio_user_dev *dev)
322 uint16_t queue_idx = vq->vq_queue_index;
323 struct vring_packed *vring;
329 vring = &dev->packed_vrings[queue_idx];
330 desc_addr = (uintptr_t)vq->vq_ring_virt_mem;
331 avail_addr = desc_addr + vq->vq_nentries *
332 sizeof(struct vring_packed_desc);
333 used_addr = RTE_ALIGN_CEIL(avail_addr +
334 sizeof(struct vring_packed_desc_event),
335 VIRTIO_PCI_VRING_ALIGN);
336 vring->num = vq->vq_nentries;
337 vring->desc = (void *)(uintptr_t)desc_addr;
338 vring->driver = (void *)(uintptr_t)avail_addr;
339 vring->device = (void *)(uintptr_t)used_addr;
340 dev->packed_queues[queue_idx].avail_wrap_counter = true;
341 dev->packed_queues[queue_idx].used_wrap_counter = true;
343 for (i = 0; i < vring->num; i++)
344 vring->desc[i].flags = 0;
348 virtio_user_setup_queue_split(struct virtqueue *vq, struct virtio_user_dev *dev)
350 uint16_t queue_idx = vq->vq_queue_index;
351 uint64_t desc_addr, avail_addr, used_addr;
353 desc_addr = (uintptr_t)vq->vq_ring_virt_mem;
354 avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
355 used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail,
356 ring[vq->vq_nentries]),
357 VIRTIO_PCI_VRING_ALIGN);
359 dev->vrings[queue_idx].num = vq->vq_nentries;
360 dev->vrings[queue_idx].desc = (void *)(uintptr_t)desc_addr;
361 dev->vrings[queue_idx].avail = (void *)(uintptr_t)avail_addr;
362 dev->vrings[queue_idx].used = (void *)(uintptr_t)used_addr;
366 virtio_user_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
368 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
370 if (vtpci_packed_queue(hw))
371 virtio_user_setup_queue_packed(vq, dev);
373 virtio_user_setup_queue_split(vq, dev);
379 virtio_user_del_queue(struct virtio_hw *hw, struct virtqueue *vq)
381 /* For legacy devices, write 0 to VIRTIO_PCI_QUEUE_PFN port, QEMU
382 * correspondingly stops the ioeventfds, and reset the status of
384 * For modern devices, set queue desc, avail, used in PCI bar to 0,
385 * not see any more behavior in QEMU.
387 * Here we just care about what information to deliver to vhost-user
388 * or vhost-kernel. So we just close ioeventfd for now.
390 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
392 close(dev->callfds[vq->vq_queue_index]);
393 close(dev->kickfds[vq->vq_queue_index]);
397 virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
400 struct virtio_user_dev *dev = virtio_user_get_dev(hw);
402 if (hw->cvq && (hw->cvq->vq == vq)) {
403 if (vtpci_packed_queue(vq->hw))
404 virtio_user_handle_cq_packed(dev, vq->vq_queue_index);
406 virtio_user_handle_cq(dev, vq->vq_queue_index);
410 if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
411 PMD_DRV_LOG(ERR, "failed to kick backend: %s",
415 const struct virtio_pci_ops virtio_user_ops = {
416 .read_dev_cfg = virtio_user_read_dev_config,
417 .write_dev_cfg = virtio_user_write_dev_config,
418 .get_status = virtio_user_get_status,
419 .set_status = virtio_user_set_status,
420 .get_features = virtio_user_get_features,
421 .set_features = virtio_user_set_features,
422 .get_isr = virtio_user_get_isr,
423 .set_config_irq = virtio_user_set_config_irq,
424 .set_queue_irq = virtio_user_set_queue_irq,
425 .get_queue_num = virtio_user_get_queue_num,
426 .setup_queue = virtio_user_setup_queue,
427 .del_queue = virtio_user_del_queue,
428 .notify_queue = virtio_user_notify_queue,
431 static const char *valid_args[] = {
432 #define VIRTIO_USER_ARG_QUEUES_NUM "queues"
433 VIRTIO_USER_ARG_QUEUES_NUM,
434 #define VIRTIO_USER_ARG_CQ_NUM "cq"
435 VIRTIO_USER_ARG_CQ_NUM,
436 #define VIRTIO_USER_ARG_MAC "mac"
438 #define VIRTIO_USER_ARG_PATH "path"
439 VIRTIO_USER_ARG_PATH,
440 #define VIRTIO_USER_ARG_QUEUE_SIZE "queue_size"
441 VIRTIO_USER_ARG_QUEUE_SIZE,
442 #define VIRTIO_USER_ARG_INTERFACE_NAME "iface"
443 VIRTIO_USER_ARG_INTERFACE_NAME,
444 #define VIRTIO_USER_ARG_SERVER_MODE "server"
445 VIRTIO_USER_ARG_SERVER_MODE,
446 #define VIRTIO_USER_ARG_MRG_RXBUF "mrg_rxbuf"
447 VIRTIO_USER_ARG_MRG_RXBUF,
448 #define VIRTIO_USER_ARG_IN_ORDER "in_order"
449 VIRTIO_USER_ARG_IN_ORDER,
450 #define VIRTIO_USER_ARG_PACKED_VQ "packed_vq"
451 VIRTIO_USER_ARG_PACKED_VQ,
455 #define VIRTIO_USER_DEF_CQ_EN 0
456 #define VIRTIO_USER_DEF_Q_NUM 1
457 #define VIRTIO_USER_DEF_Q_SZ 256
458 #define VIRTIO_USER_DEF_SERVER_MODE 0
461 get_string_arg(const char *key __rte_unused,
462 const char *value, void *extra_args)
464 if (!value || !extra_args)
467 *(char **)extra_args = strdup(value);
469 if (!*(char **)extra_args)
476 get_integer_arg(const char *key __rte_unused,
477 const char *value, void *extra_args)
479 if (!value || !extra_args)
482 *(uint64_t *)extra_args = strtoull(value, NULL, 0);
487 static struct rte_eth_dev *
488 virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)
490 struct rte_eth_dev *eth_dev;
491 struct rte_eth_dev_data *data;
492 struct virtio_hw *hw;
493 struct virtio_user_dev *dev;
495 eth_dev = rte_eth_vdev_allocate(vdev, sizeof(*hw));
497 PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
501 data = eth_dev->data;
502 hw = eth_dev->data->dev_private;
504 dev = rte_zmalloc(NULL, sizeof(*dev), 0);
506 PMD_INIT_LOG(ERR, "malloc virtio_user_dev failed");
507 rte_eth_dev_release_port(eth_dev);
511 hw->port_id = data->port_id;
512 dev->port_id = data->port_id;
513 virtio_hw_internal[hw->port_id].vtpci_ops = &virtio_user_ops;
515 * MSIX is required to enable LSC (see virtio_init_device).
516 * Here just pretend that we support msix.
520 hw->use_simple_rx = 0;
521 hw->use_inorder_rx = 0;
522 hw->use_inorder_tx = 0;
523 hw->virtio_user_dev = dev;
528 virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev)
530 struct rte_eth_dev_data *data = eth_dev->data;
531 struct virtio_hw *hw = data->dev_private;
533 rte_free(hw->virtio_user_dev);
534 rte_eth_dev_release_port(eth_dev);
537 /* Dev initialization routine. Invoked once for each virtio vdev at
538 * EAL init time, see rte_bus_probe().
539 * Returns 0 on success.
542 virtio_user_pmd_probe(struct rte_vdev_device *dev)
544 struct rte_kvargs *kvlist = NULL;
545 struct rte_eth_dev *eth_dev;
546 struct virtio_hw *hw;
547 uint64_t queues = VIRTIO_USER_DEF_Q_NUM;
548 uint64_t cq = VIRTIO_USER_DEF_CQ_EN;
549 uint64_t queue_size = VIRTIO_USER_DEF_Q_SZ;
550 uint64_t server_mode = VIRTIO_USER_DEF_SERVER_MODE;
551 uint64_t mrg_rxbuf = 1;
552 uint64_t in_order = 1;
553 uint64_t packed_vq = 0;
556 char *mac_addr = NULL;
559 if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
560 const char *name = rte_vdev_device_name(dev);
561 eth_dev = rte_eth_dev_attach_secondary(name);
563 RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
567 if (eth_virtio_dev_init(eth_dev) < 0) {
568 PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
569 rte_eth_dev_release_port(eth_dev);
573 eth_dev->dev_ops = &virtio_user_secondary_eth_dev_ops;
574 eth_dev->device = &dev->device;
575 rte_eth_dev_probing_finish(eth_dev);
579 kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_args);
581 PMD_INIT_LOG(ERR, "error when parsing param");
585 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1) {
586 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PATH,
587 &get_string_arg, &path) < 0) {
588 PMD_INIT_LOG(ERR, "error to parse %s",
589 VIRTIO_USER_ARG_PATH);
593 PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user",
594 VIRTIO_USER_ARG_PATH);
598 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_INTERFACE_NAME) == 1) {
599 if (is_vhost_user_by_type(path)) {
601 "arg %s applies only to vhost-kernel backend",
602 VIRTIO_USER_ARG_INTERFACE_NAME);
606 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_INTERFACE_NAME,
607 &get_string_arg, &ifname) < 0) {
608 PMD_INIT_LOG(ERR, "error to parse %s",
609 VIRTIO_USER_ARG_INTERFACE_NAME);
614 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_MAC) == 1) {
615 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_MAC,
616 &get_string_arg, &mac_addr) < 0) {
617 PMD_INIT_LOG(ERR, "error to parse %s",
618 VIRTIO_USER_ARG_MAC);
623 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_QUEUE_SIZE) == 1) {
624 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_QUEUE_SIZE,
625 &get_integer_arg, &queue_size) < 0) {
626 PMD_INIT_LOG(ERR, "error to parse %s",
627 VIRTIO_USER_ARG_QUEUE_SIZE);
632 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_QUEUES_NUM) == 1) {
633 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_QUEUES_NUM,
634 &get_integer_arg, &queues) < 0) {
635 PMD_INIT_LOG(ERR, "error to parse %s",
636 VIRTIO_USER_ARG_QUEUES_NUM);
641 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_SERVER_MODE) == 1) {
642 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_SERVER_MODE,
643 &get_integer_arg, &server_mode) < 0) {
644 PMD_INIT_LOG(ERR, "error to parse %s",
645 VIRTIO_USER_ARG_SERVER_MODE);
650 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_CQ_NUM) == 1) {
651 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_CQ_NUM,
652 &get_integer_arg, &cq) < 0) {
653 PMD_INIT_LOG(ERR, "error to parse %s",
654 VIRTIO_USER_ARG_CQ_NUM);
657 } else if (queues > 1) {
661 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PACKED_VQ) == 1) {
662 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PACKED_VQ,
663 &get_integer_arg, &packed_vq) < 0) {
664 PMD_INIT_LOG(ERR, "error to parse %s",
665 VIRTIO_USER_ARG_PACKED_VQ);
670 if (queues > 1 && cq == 0) {
671 PMD_INIT_LOG(ERR, "multi-q requires ctrl-q");
675 if (queues > VIRTIO_MAX_VIRTQUEUE_PAIRS) {
676 PMD_INIT_LOG(ERR, "arg %s %" PRIu64 " exceeds the limit %u",
677 VIRTIO_USER_ARG_QUEUES_NUM, queues,
678 VIRTIO_MAX_VIRTQUEUE_PAIRS);
682 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_MRG_RXBUF) == 1) {
683 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_MRG_RXBUF,
684 &get_integer_arg, &mrg_rxbuf) < 0) {
685 PMD_INIT_LOG(ERR, "error to parse %s",
686 VIRTIO_USER_ARG_MRG_RXBUF);
691 if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_IN_ORDER) == 1) {
692 if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_IN_ORDER,
693 &get_integer_arg, &in_order) < 0) {
694 PMD_INIT_LOG(ERR, "error to parse %s",
695 VIRTIO_USER_ARG_IN_ORDER);
700 eth_dev = virtio_user_eth_dev_alloc(dev);
702 PMD_INIT_LOG(ERR, "virtio_user fails to alloc device");
706 hw = eth_dev->data->dev_private;
707 if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,
708 queue_size, mac_addr, &ifname, server_mode,
709 mrg_rxbuf, in_order, packed_vq) < 0) {
710 PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
711 virtio_user_eth_dev_free(eth_dev);
715 /* previously called by rte_pci_probe() for physical dev */
716 if (eth_virtio_dev_init(eth_dev) < 0) {
717 PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
718 virtio_user_eth_dev_free(eth_dev);
722 rte_eth_dev_probing_finish(eth_dev);
727 rte_kvargs_free(kvlist);
738 virtio_user_pmd_remove(struct rte_vdev_device *vdev)
741 struct rte_eth_dev *eth_dev;
746 name = rte_vdev_device_name(vdev);
747 PMD_DRV_LOG(INFO, "Un-Initializing %s", name);
748 eth_dev = rte_eth_dev_allocated(name);
749 /* Port has already been released by close. */
753 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
754 return rte_eth_dev_release_port(eth_dev);
756 /* make sure the device is stopped, queues freed */
757 rte_eth_dev_close(eth_dev->data->port_id);
762 static struct rte_vdev_driver virtio_user_driver = {
763 .probe = virtio_user_pmd_probe,
764 .remove = virtio_user_pmd_remove,
767 RTE_PMD_REGISTER_VDEV(net_virtio_user, virtio_user_driver);
768 RTE_PMD_REGISTER_ALIAS(net_virtio_user, virtio_user);
769 RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,