Imported Upstream version 16.11
[deb_dpdk.git] / drivers / net / ring / rte_eth_ring.c
index 5551e18..c1767c4 100644 (file)
@@ -38,7 +38,7 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
 #include <rte_kvargs.h>
 #include <rte_errno.h>
 
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
        }
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL) {
                rte_errno = ENOSPC;
                goto error;
@@ -505,7 +505,7 @@ out:
 }
 
 static int
-rte_pmd_ring_devinit(const char *name, const char *params)
+rte_pmd_ring_probe(const char *name, const char *params)
 {
        struct rte_kvargs *kvlist = NULL;
        int ret = 0;
@@ -580,7 +580,7 @@ out_free:
 }
 
 static int
-rte_pmd_ring_devuninit(const char *name)
+rte_pmd_ring_remove(const char *name)
 {
        struct rte_eth_dev *eth_dev = NULL;
        struct pmd_internals *internals = NULL;
@@ -599,36 +599,34 @@ rte_pmd_ring_devuninit(const char *name)
 
        eth_dev_stop(eth_dev);
 
-       if (eth_dev->data) {
-               internals = eth_dev->data->dev_private;
-               if (internals->action == DEV_CREATE) {
-                       /*
-                        * it is only necessary to delete the rings in rx_queues because
-                        * they are the same used in tx_queues
-                        */
-                       for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
-                               r = eth_dev->data->rx_queues[i];
-                               rte_ring_free(r->rng);
-                       }
+       internals = eth_dev->data->dev_private;
+       if (internals->action == DEV_CREATE) {
+               /*
+                * it is only necessary to delete the rings in rx_queues because
+                * they are the same used in tx_queues
+                */
+               for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+                       r = eth_dev->data->rx_queues[i];
+                       rte_ring_free(r->rng);
                }
-
-               rte_free(eth_dev->data->rx_queues);
-               rte_free(eth_dev->data->tx_queues);
-               rte_free(eth_dev->data->dev_private);
        }
 
+       rte_free(eth_dev->data->rx_queues);
+       rte_free(eth_dev->data->tx_queues);
+       rte_free(eth_dev->data->dev_private);
+
        rte_free(eth_dev->data);
 
        rte_eth_dev_release_port(eth_dev);
        return 0;
 }
 
-static struct rte_driver pmd_ring_drv = {
-       .type = PMD_VDEV,
-       .init = rte_pmd_ring_devinit,
-       .uninit = rte_pmd_ring_devuninit,
+static struct rte_vdev_driver pmd_ring_drv = {
+       .probe = rte_pmd_ring_probe,
+       .remove = rte_pmd_ring_remove,
 };
 
-PMD_REGISTER_DRIVER(pmd_ring_drv, eth_ring);
-DRIVER_REGISTER_PARAM_STRING(eth_ring,
-       "nodeaction=[attach|detach]");
+RTE_PMD_REGISTER_VDEV(net_ring, pmd_ring_drv);
+RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring);
+RTE_PMD_REGISTER_PARAM_STRING(net_ring,
+       ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)");