X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnx2x%2Fbnx2x_ethdev.c;h=7a1e9f5832430f191e6878f599b0cf3086b57c4d;hb=fbe90cdd776c3ac99c4c56d1b5318a90fcf01602;hp=b79cfdb0de5458f8f9defbf90fb4b8cefeee2ca4;hpb=6d01e580ac5da3115f3adf5cdf5d048e358c9324;p=dpdk.git diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index b79cfdb0de..7a1e9f5832 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -14,6 +14,9 @@ #include #include +int bnx2x_logtype_init; +int bnx2x_logtype_driver; + /* * The set of PCI devices this driver supports */ @@ -119,7 +122,7 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev) bnx2x_link_update(dev); } -static __rte_unused void +static void bnx2x_interrupt_handler(void *param) { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; @@ -137,11 +140,13 @@ static int bnx2x_dev_configure(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + int mp_ncpus = sysconf(_SC_NPROCESSORS_CONF); PMD_INIT_FUNC_TRACE(); - if (dev->data->dev_conf.rxmode.jumbo_frame) + if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) sc->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len; if (dev->data->nb_tx_queues > dev->data->nb_rx_queues) { @@ -329,7 +334,7 @@ bnx2xvf_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_comple return old_link_status == dev->data->dev_link.link_status ? -1 : 0; } -static void +static int bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -389,6 +394,8 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->imissed = brb_drops + brb_truncates + brb_truncate_discard + stats->rx_nombuf; + + return 0; } static int @@ -439,16 +446,16 @@ bnx2x_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, } static void -bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_info *dev_info) +bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct bnx2x_softc *sc = dev->data->dev_private; - dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device); dev_info->max_rx_queues = sc->max_rx_queues; dev_info->max_tx_queues = sc->max_tx_queues; dev_info->min_rx_bufsize = BNX2X_MIN_RX_BUF_SIZE; dev_info->max_rx_pktlen = BNX2X_MAX_RX_PKT_LEN; dev_info->max_mac_addrs = BNX2X_MAX_MAC_ADDRS; dev_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_20G; + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME; } static int @@ -531,7 +538,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) PMD_INIT_FUNC_TRACE(); eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops : &bnx2x_eth_dev_ops; - pci_dev = RTE_DEV_TO_PCI(eth_dev->device); + pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); rte_eth_copy_pci_info(eth_dev, pci_dev); @@ -637,24 +644,14 @@ static struct rte_pci_driver rte_bnx2xvf_pmd; static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { - struct rte_eth_dev *eth_dev; - int ret; - - eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct bnx2x_softc)); - if (!eth_dev) - return -ENOMEM; - if (pci_drv == &rte_bnx2x_pmd) - ret = eth_bnx2x_dev_init(eth_dev); + return rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct bnx2x_softc), eth_bnx2x_dev_init); else if (pci_drv == &rte_bnx2xvf_pmd) - ret = eth_bnx2xvf_dev_init(eth_dev); + return rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct bnx2x_softc), eth_bnx2xvf_dev_init); else - ret = -EINVAL; - - if (ret) - rte_eth_dev_pci_release(eth_dev); - - return ret; + return -EINVAL; } static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev) @@ -681,7 +678,19 @@ static struct rte_pci_driver rte_bnx2xvf_pmd = { RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map); -RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio"); +RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map); -RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio"); +RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio-pci"); + +RTE_INIT(bnx2x_init_log); +static void +bnx2x_init_log(void) +{ + bnx2x_logtype_init = rte_log_register("pmd.net.bnx2x.init"); + if (bnx2x_logtype_init >= 0) + rte_log_set_level(bnx2x_logtype_init, RTE_LOG_NOTICE); + bnx2x_logtype_driver = rte_log_register("pmd.net.bnx2x.driver"); + if (bnx2x_logtype_driver >= 0) + rte_log_set_level(bnx2x_logtype_driver, RTE_LOG_NOTICE); +}