#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>
volatile uint64_t err_pkts;
};
-int szedata2_logtype_init;
-int szedata2_logtype_driver;
-
static struct rte_ether_addr eth_addr = {
.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
};
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
return 0;
}
-static void
+static int
eth_dev_info(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
dev_info->rx_queue_offload_capa = 0;
dev_info->tx_queue_offload_capa = 0;
dev_info->speed_capa = ETH_LINK_SPEED_100G;
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
txq->tx_bytes = 0;
txq->err_pkts = 0;
}
+
+ return 0;
}
static void
}
}
-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;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ ret = eth_dev_stop(dev);
- eth_dev_stop(dev);
+ free(internals->sze_dev_path);
for (i = 0; i < nb_rx; i++) {
eth_rx_queue_release(dev->data->rx_queues[i]);
dev->data->tx_queues[i] = NULL;
}
dev->data->nb_tx_queues = 0;
+
+ return ret;
}
static int
return 0;
}
-static void
+static int
eth_promiscuous_enable(struct rte_eth_dev *dev __rte_unused)
{
PMD_DRV_LOG(WARNING, "Enabling promiscuous mode is not supported. "
"The card is always in promiscuous mode.");
+ return 0;
}
-static void
+static int
eth_promiscuous_disable(struct rte_eth_dev *dev __rte_unused)
{
PMD_DRV_LOG(WARNING, "Disabling promiscuous mode is not supported. "
"The card is always in promiscuous mode.");
+ return -ENOTSUP;
}
-static void
+static int
eth_allmulticast_enable(struct rte_eth_dev *dev __rte_unused)
{
PMD_DRV_LOG(WARNING, "Enabling allmulticast mode is not supported.");
+ return -ENOTSUP;
}
-static void
+static int
eth_allmulticast_disable(struct rte_eth_dev *dev __rte_unused)
{
PMD_DRV_LOG(WARNING, "Disabling allmulticast mode is not supported.");
+ return -ENOTSUP;
}
static const struct eth_dev_ops ops = {
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);
static int
rte_szedata2_eth_dev_uninit(struct rte_eth_dev *dev)
{
- struct pmd_internals *internals = (struct pmd_internals *)
- dev->data->dev_private;
-
PMD_INIT_FUNC_TRACE();
- free(internals->sze_dev_path);
+ eth_dev_close(dev);
PMD_DRV_LOG(INFO, "%s device %s successfully uninitialized",
RTE_STR(RTE_SZEDATA2_DRIVER_NAME), dev->data->name);
RTE_PCI_DEVICE(PCI_VENDOR_ID_NETCOPE,
PCI_DEVICE_ID_NETCOPE_NFB200G2QL)
},
+ {
+ RTE_PCI_DEVICE(PCI_VENDOR_ID_SILICOM,
+ PCI_DEVICE_ID_FB2CGG3)
+ },
+ {
+ RTE_PCI_DEVICE(PCI_VENDOR_ID_SILICOM,
+ PCI_DEVICE_ID_FB2CGG3D)
+ },
{
.vendor_id = 0,
}
for (i = from; i < to; i++) {
rte_szedata2_eth_dev_uninit(eth_devs[i]);
- rte_eth_dev_pci_release(eth_devs[i]);
+ rte_eth_dev_release_port(eth_devs[i]);
}
}
if (ret != 0) {
PMD_INIT_LOG(ERR, "Failed to init eth_dev for port %u",
i);
- rte_eth_dev_pci_release(eth_devs[i]);
+ rte_eth_dev_release_port(eth_devs[i]);
szedata2_eth_dev_release_interval(eth_devs, 0, i);
rte_free(list_entry);
return ret;
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) {
retval = retval ? retval : ret;
}
- rte_eth_dev_pci_release(eth_dev);
+ rte_eth_dev_release_port(eth_dev);
}
return retval;
RTE_PMD_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
RTE_PMD_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
"* combo6core & combov3 & szedata2 & ( szedata2_cv3 | szedata2_cv3_fdt )");
-
-RTE_INIT(szedata2_init_log)
-{
- szedata2_logtype_init = rte_log_register("pmd.net.szedata2.init");
- if (szedata2_logtype_init >= 0)
- rte_log_set_level(szedata2_logtype_init, RTE_LOG_NOTICE);
- szedata2_logtype_driver = rte_log_register("pmd.net.szedata2.driver");
- if (szedata2_logtype_driver >= 0)
- rte_log_set_level(szedata2_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER_SUFFIX(szedata2_logtype_init, init, NOTICE);
+RTE_LOG_REGISTER_SUFFIX(szedata2_logtype_driver, driver, NOTICE);