X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnfb%2Fnfb_ethdev.c;h=b039ab6fc273defcfbc56fba2c047512e29eb1f3;hb=c47d6e83334e656f85e4bb6881cf63da38276b0a;hp=3472a8df60c34fe8aed37ccd7418e1838b23fc20;hpb=f37c57a1a33027e8e3a686107f3b8feb13c132ba;p=dpdk.git diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index 3472a8df60..b039ab6fc2 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -10,6 +10,7 @@ #include #include +#include #include "nfb_stats.h" #include "nfb_rx.h" @@ -187,7 +188,7 @@ nfb_eth_dev_configure(struct rte_eth_dev *dev __rte_unused) * @param[out] info * Info structure output buffer. */ -static void +static int nfb_eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -196,6 +197,8 @@ nfb_eth_dev_info(struct rte_eth_dev *dev, dev_info->max_rx_queues = dev->data->nb_rx_queues; dev_info->max_tx_queues = dev->data->nb_tx_queues; dev_info->speed_capa = ETH_LINK_SPEED_100G; + + return 0; } /** @@ -209,12 +212,16 @@ nfb_eth_dev_info(struct rte_eth_dev *dev, static void nfb_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; nfb_eth_dev_stop(dev); + nfb_nc_rxmac_deinit(internals->rxmac, internals->max_rxmac); + nfb_nc_txmac_deinit(internals->txmac, internals->max_txmac); + for (i = 0; i < nb_rx; i++) { nfb_eth_rx_queue_release(dev->data->rx_queues[i]); dev->data->rx_queues[i] = NULL; @@ -225,6 +232,9 @@ nfb_eth_dev_close(struct rte_eth_dev *dev) dev->data->tx_queues[i] = NULL; } dev->data->nb_tx_queues = 0; + + rte_free(dev->data->mac_addrs); + dev->data->mac_addrs = NULL; } /** @@ -419,6 +429,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_pci_addr *pci_addr = &pci_dev->addr; struct rte_ether_addr eth_addr_init; + struct rte_kvargs *kvlist; RTE_LOG(INFO, PMD, "Initializing NFB device (" PCI_PRI_FMT ")\n", pci_addr->domain, pci_addr->bus, pci_addr->devid, @@ -429,6 +440,24 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) pci_addr->domain, pci_addr->bus, pci_addr->devid, pci_addr->function); + /* Check validity of device args */ + if (dev->device->devargs != NULL && + dev->device->devargs->args != NULL && + strlen(dev->device->devargs->args) > 0) { + kvlist = rte_kvargs_parse(dev->device->devargs->args, + VALID_KEYS); + if (kvlist == NULL) { + RTE_LOG(ERR, PMD, "Failed to parse device arguments %s", + dev->device->devargs->args); + rte_kvargs_free(kvlist); + return -EINVAL; + } + rte_kvargs_free(kvlist); + } + + /* Let rte_eth_dev_close() release the port resources */ + dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + /* * Get number of available DMA RX and TX queues, which is maximum * number of queues that can be created and store it in private device @@ -503,15 +532,10 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) static int nfb_eth_dev_uninit(struct rte_eth_dev *dev) { - struct rte_eth_dev_data *data = dev->data; - struct pmd_internals *internals = (struct pmd_internals *) - data->dev_private; - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_pci_addr *pci_addr = &pci_dev->addr; - nfb_nc_rxmac_deinit(internals->rxmac, internals->max_rxmac); - nfb_nc_txmac_deinit(internals->txmac, internals->max_txmac); + nfb_eth_dev_close(dev); RTE_LOG(INFO, PMD, "NFB device (" PCI_PRI_FMT ") successfully uninitialized\n", @@ -577,3 +601,4 @@ static struct rte_pci_driver nfb_eth_driver = { RTE_PMD_REGISTER_PCI(RTE_NFB_DRIVER_NAME, nfb_eth_driver); RTE_PMD_REGISTER_PCI_TABLE(RTE_NFB_DRIVER_NAME, nfb_pci_id_table); RTE_PMD_REGISTER_KMOD_DEP(RTE_NFB_DRIVER_NAME, "* nfb"); +RTE_PMD_REGISTER_PARAM_STRING(RTE_NFB_DRIVER_NAME, TIMESTAMP_ARG "=<0|1>");