#include <netcope/rxmac.h>
#include <netcope/txmac.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_pci.h>
#include <rte_kvargs.h>
#include "nfb_stats.h"
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
nfb_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;
+ dev->data->dev_started = 0;
+
for (i = 0; i < nb_tx; i++)
nfb_eth_tx_queue_stop(dev, i);
for (i = 0; i < nb_rx; i++)
nfb_eth_rx_queue_stop(dev, i);
+
+ return 0;
}
/**
* @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)
{
dev_info->max_rx_pktlen = (uint32_t)-1;
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;
+ dev_info->speed_capa = RTE_ETH_LINK_SPEED_100G;
+
+ return 0;
}
/**
* @param dev
* Pointer to Ethernet device structure.
*/
-static void
+static int
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;
+ int ret;
- nfb_eth_dev_stop(dev);
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ ret = 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]);
+ nfb_eth_rx_queue_release(dev, i);
dev->data->rx_queues[i] = NULL;
}
dev->data->nb_rx_queues = 0;
for (i = 0; i < nb_tx; i++) {
- nfb_eth_tx_queue_release(dev->data->tx_queues[i]);
+ nfb_eth_tx_queue_release(dev, i);
dev->data->tx_queues[i] = NULL;
}
dev->data->nb_tx_queues = 0;
+
+ return ret;
}
/**
status.speed = MAC_SPEED_UNKNOWN;
- link.link_speed = ETH_SPEED_NUM_NONE;
- link.link_status = ETH_LINK_DOWN;
- link.link_duplex = ETH_LINK_FULL_DUPLEX;
- link.link_autoneg = ETH_LINK_SPEED_FIXED;
+ link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+ link.link_status = RTE_ETH_LINK_DOWN;
+ link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+ link.link_autoneg = RTE_ETH_LINK_SPEED_FIXED;
if (internals->rxmac[0] != NULL) {
nc_rxmac_read_status(internals->rxmac[0], &status);
switch (status.speed) {
case MAC_SPEED_10G:
- link.link_speed = ETH_SPEED_NUM_10G;
+ link.link_speed = RTE_ETH_SPEED_NUM_10G;
break;
case MAC_SPEED_40G:
- link.link_speed = ETH_SPEED_NUM_40G;
+ link.link_speed = RTE_ETH_SPEED_NUM_40G;
break;
case MAC_SPEED_100G:
- link.link_speed = ETH_SPEED_NUM_100G;
+ link.link_speed = RTE_ETH_SPEED_NUM_100G;
break;
default:
- link.link_speed = ETH_SPEED_NUM_NONE;
+ link.link_speed = RTE_ETH_SPEED_NUM_NONE;
break;
}
}
nc_rxmac_read_status(internals->rxmac[i], &status);
if (status.enabled && status.link_up) {
- link.link_status = ETH_LINK_UP;
+ link.link_status = RTE_ETH_LINK_UP;
break;
}
}
data->all_multicast = nfb_eth_allmulticast_get(dev);
internals->rx_filter_original = data->promiscuous;
+ dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
+
RTE_LOG(INFO, PMD, "NFB device ("
PCI_PRI_FMT ") successfully initialized\n",
pci_addr->domain, pci_addr->bus, pci_addr->devid,
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",