#include <libsze2.h>
#include <rte_mbuf.h>
-#include <rte_ethdev_driver.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_kvargs.h>
return ret;
}
-static void
+static int
eth_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
+ int ret;
- for (i = 0; i < nb_tx; i++)
- eth_tx_queue_stop(dev, i);
+ dev->data->dev_started = 0;
- for (i = 0; i < nb_rx; i++)
- eth_rx_queue_stop(dev, i);
+ for (i = 0; i < nb_tx; i++) {
+ ret = eth_tx_queue_stop(dev, i);
+ if (ret != 0)
+ return ret;
+ }
+
+ for (i = 0; i < nb_rx; i++) {
+ ret = eth_rx_queue_stop(dev, i);
+ if (ret != 0)
+ return ret;
+ }
+
+ return 0;
}
static int
}
}
-static void
+static int
eth_dev_close(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = dev->data->dev_private;
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
+ int ret;
- eth_dev_stop(dev);
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ ret = eth_dev_stop(dev);
free(internals->sze_dev_path);
}
dev->data->nb_tx_queues = 0;
- rte_free(dev->data->mac_addrs);
- dev->data->mac_addrs = NULL;
+ return ret;
}
static int
PMD_INIT_LOG(INFO, "Initializing eth_dev %s (driver %s)", data->name,
RTE_STR(RTE_SZEDATA2_DRIVER_NAME));
- /* Let rte_eth_dev_close() release the port resources */
- dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
-
/* Fill internal private structure. */
internals->dev = dev;
/* Get index of szedata2 device file and create path to device file */
rte_ether_addr_copy(ð_addr, data->mac_addrs);
+ dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
+
PMD_INIT_LOG(INFO, "%s device %s successfully initialized",
RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name);
pci_dev->device.name, i);
PMD_DRV_LOG(DEBUG, "Removing eth_dev %s", name);
eth_dev = rte_eth_dev_allocated(name);
- if (!eth_dev) {
- PMD_DRV_LOG(ERR, "eth_dev %s not found", name);
- retval = retval ? retval : -ENODEV;
- }
+ if (eth_dev == NULL)
+ continue; /* port already released */
ret = rte_szedata2_eth_dev_uninit(eth_dev);
if (ret != 0) {