+static int
+eth_dev_xenvirt_free(const char *name, const unsigned numa_node)
+{
+ struct rte_eth_dev *eth_dev = NULL;
+
+ RTE_LOG(DEBUG, PMD,
+ "Free virtio rings backed ethdev on numa socket %u\n",
+ numa_node);
+
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -1;
+
+ if (eth_dev->data->dev_started == 1) {
+ eth_dev_stop(eth_dev);
+ eth_dev_close(eth_dev);
+ }
+
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+ eth_dev->dev_ops = NULL;
+
+ rte_free(eth_dev->data);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data->mac_addrs);
+
+ virtio_idx--;
+
+ return 0;
+}
+