net/virtio: fix crash when device reconnecting
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index dfc5291..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);