net/virtio: fix crash when device reconnecting
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index c54698a..798f191 100644 (file)
@@ -89,7 +89,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
        dev->features &= dev->device_features;
 
        /* For packed ring, resetting queues is required in reconnection. */
-       if (vtpci_packed_queue(hw)) {
+       if (vtpci_packed_queue(hw) &&
+          (vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_DRIVER_OK)) {
                PMD_INIT_LOG(NOTICE, "Packets on the fly will be dropped"
                                " when packed ring reconnecting.");
                virtio_user_reset_queues_packed(eth_dev);
@@ -733,7 +734,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
                goto end;
        }
 
-       /* previously called by rte_pci_probe() for physical dev */
+       /* previously called by pci probing for physical dev */
        if (eth_virtio_dev_init(eth_dev) < 0) {
                PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
                virtio_user_eth_dev_free(eth_dev);