diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2019-03-20 14:45:09 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2019-03-20 14:45:37 +0000 |
commit | f7a9461e29147c47ce2bb81bd157ac1833cf5eb1 (patch) | |
tree | 6f3b4f4850cf9f116acc1dda3f0515259673e13b /drivers/net/virtio | |
parent | 8e6d9d118f6105a3627b64a7949e1fb0b145879e (diff) |
New upstream version 16.11.9upstream/16.11.9upstream-16.11-stable
Change-Id: Ia1ac246c53e5050b6a29d6952fb668ad6c782996
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'drivers/net/virtio')
-rw-r--r-- | drivers/net/virtio/virtio_ethdev.c | 26 | ||||
-rw-r--r-- | drivers/net/virtio/virtio_ethdev.h | 6 | ||||
-rw-r--r-- | drivers/net/virtio/virtio_user/virtio_user_dev.c | 15 | ||||
-rw-r--r-- | drivers/net/virtio/virtio_user_ethdev.c | 2 |
4 files changed, 33 insertions, 16 deletions
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 5a27ab77..6f950f0f 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1394,11 +1394,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) if (ret < 0) return ret; - /* Setup interrupt callback */ - if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - rte_intr_callback_register(&pci_dev->intr_handle, - virtio_interrupt_handler, eth_dev); - return 0; } @@ -1423,11 +1418,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) rte_free(eth_dev->data->mac_addrs); eth_dev->data->mac_addrs = NULL; - /* reset interrupt callback */ - if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - rte_intr_callback_unregister(&pci_dev->intr_handle, - virtio_interrupt_handler, - eth_dev); rte_eal_pci_unmap_device(pci_dev); PMD_INIT_LOG(DEBUG, "dev_uninit completed"); @@ -1538,6 +1528,12 @@ virtio_dev_start(struct rte_eth_dev *dev) return -ENOTSUP; } + /* Setup interrupt callback */ + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + rte_intr_callback_register(&dev->pci_dev->intr_handle, + virtio_interrupt_handler, + dev); + if (rte_intr_enable(&dev->pci_dev->intr_handle) < 0) { PMD_DRV_LOG(ERR, "interrupt enable failed"); return -EIO; @@ -1645,9 +1641,17 @@ virtio_dev_stop(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "stop"); - if (dev->data->dev_conf.intr_conf.lsc) + if (dev->data->dev_conf.intr_conf.lsc) { rte_intr_disable(&dev->pci_dev->intr_handle); + /* Reset interrupt callback */ + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { + rte_intr_callback_unregister(&dev->pci_dev->intr_handle, + virtio_interrupt_handler, + dev); + } + } + hw->started = 0; memset(&link, 0, sizeof(link)); virtio_dev_atomic_write_link_status(dev, &link); diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index c491ec1b..5122792a 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -74,7 +74,11 @@ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \ 1u << VIRTIO_NET_F_GUEST_CSUM | \ 1u << VIRTIO_NET_F_GUEST_TSO4 | \ - 1u << VIRTIO_NET_F_GUEST_TSO6) + 1u << VIRTIO_NET_F_GUEST_TSO6 | \ + 1u << VIRTIO_NET_F_CSUM | \ + 1u << VIRTIO_NET_F_HOST_TSO4 | \ + 1u << VIRTIO_NET_F_HOST_TSO6) + /* * CQ function prototype */ diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 8bb155d8..3e6787a0 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -142,9 +142,6 @@ virtio_user_start_device(struct virtio_user_dev *dev) uint64_t features; int ret; - /* Do not check return as already done in init, or reset in stop */ - vhost_user_sock(dev->vhostfd, VHOST_USER_SET_OWNER, NULL); - /* Step 0: tell vhost to create queues */ if (virtio_user_queue_setup(dev, virtio_user_create_queue) < 0) goto error; @@ -185,6 +182,7 @@ error: int virtio_user_stop_device(struct virtio_user_dev *dev) { + struct vhost_vring_state state; uint32_t i; for (i = 0; i < dev->max_queue_pairs * 2; ++i) { @@ -195,6 +193,17 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) for (i = 0; i < dev->max_queue_pairs; ++i) vhost_user_enable_queue_pair(dev->vhostfd, i, 0); + /* Stop the backend. */ + for (i = 0; i < dev->max_queue_pairs * 2; ++i) { + state.index = i; + if (vhost_user_sock(dev->vhostfd, VHOST_USER_GET_VRING_BASE, + &state) < 0) { + PMD_DRV_LOG(ERR, "get_vring_base failed, index=%u\n", + i); + return -1; + } + } + return 0; } diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index b1bd6234..caa9be5a 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -369,7 +369,7 @@ virtio_user_pmd_probe(const char *name, const char *params) } } else { PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user\n", - VIRTIO_USER_ARG_QUEUE_SIZE); + VIRTIO_USER_ARG_PATH); goto end; } |