net/virtio: fix crash when closing twice
[dpdk.git] / lib / librte_ether / rte_ethdev.c
index b89a696..ef137c3 100644 (file)
@@ -749,16 +749,19 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                return -EINVAL;
        }
 
-       /*
-        * If link state interrupt is enabled, check that the
-        * device supports it.
-        */
+       /* Check that the device supports requested interrupts */
        if ((dev_conf->intr_conf.lsc == 1) &&
                (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
                        RTE_PMD_DEBUG_TRACE("driver %s does not support lsc\n",
                                        dev->data->drv_name);
                        return -EINVAL;
        }
+       if ((dev_conf->intr_conf.rmv == 1) &&
+           (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_RMV))) {
+               RTE_PMD_DEBUG_TRACE("driver %s does not support rmv\n",
+                                   dev->data->drv_name);
+               return -EINVAL;
+       }
 
        /*
         * If jumbo frames are enabled, check that the maximum RX packet
@@ -983,8 +986,10 @@ rte_eth_dev_close(uint8_t port_id)
        dev->data->dev_started = 0;
        (*dev->dev_ops->dev_close)(dev);
 
+       dev->data->nb_rx_queues = 0;
        rte_free(dev->data->rx_queues);
        dev->data->rx_queues = NULL;
+       dev->data->nb_tx_queues = 0;
        rte_free(dev->data->tx_queues);
        dev->data->tx_queues = NULL;
 }