X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fatlantic%2Fatl_ethdev.c;h=2217511ca0ee21a938a893be1ee1036ceba2b088;hb=42c40f8902f7d9cf5a51c1ec0e1bfff515b50561;hp=d5c2ec594a77ea34654ef67d4bfc339cbcf97c61;hpb=c1339892ddfe74703fff1c2c126c68d9e7e17464;p=dpdk.git diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index d5c2ec594a..2217511ca0 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -15,14 +15,12 @@ #include "hw_atl/hw_atl_b0_internal.h" static int eth_atl_dev_init(struct rte_eth_dev *eth_dev); -static int eth_atl_dev_uninit(struct rte_eth_dev *eth_dev); - static int atl_dev_configure(struct rte_eth_dev *dev); static int atl_dev_start(struct rte_eth_dev *dev); static void atl_dev_stop(struct rte_eth_dev *dev); static int atl_dev_set_link_up(struct rte_eth_dev *dev); static int atl_dev_set_link_down(struct rte_eth_dev *dev); -static void atl_dev_close(struct rte_eth_dev *dev); +static int atl_dev_close(struct rte_eth_dev *dev); static int atl_dev_reset(struct rte_eth_dev *dev); static int atl_dev_promiscuous_enable(struct rte_eth_dev *dev); static int atl_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -120,9 +118,6 @@ static int eth_atl_pci_remove(struct rte_pci_device *pci_dev); static int atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); -int atl_logtype_init; -int atl_logtype_driver; - /* * The set of PCI devices this driver supports */ @@ -316,10 +311,6 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .rx_queue_intr_enable = atl_dev_rx_queue_intr_enable, .rx_queue_intr_disable = atl_dev_rx_queue_intr_disable, - .rx_queue_count = atl_rx_queue_count, - .rx_descriptor_status = atl_dev_rx_descriptor_status, - .tx_descriptor_status = atl_dev_tx_descriptor_status, - /* EEPROM */ .get_eeprom_length = atl_dev_get_eeprom_length, .get_eeprom = atl_dev_get_eeprom, @@ -376,6 +367,11 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); eth_dev->dev_ops = &atl_eth_dev_ops; + + eth_dev->rx_queue_count = atl_rx_queue_count; + eth_dev->rx_descriptor_status = atl_dev_rx_descriptor_status; + eth_dev->tx_descriptor_status = atl_dev_tx_descriptor_status; + eth_dev->rx_pkt_burst = &atl_recv_pkts; eth_dev->tx_pkt_burst = &atl_xmit_pkts; eth_dev->tx_pkt_prepare = &atl_prep_pkts; @@ -407,6 +403,8 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) hw->aq_nic_cfg = &adapter->hw_cfg; + pthread_mutex_init(&hw->mbox_mutex, NULL); + /* disable interrupt */ atl_disable_intr(hw); @@ -442,38 +440,6 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) return err; } -static int -eth_atl_dev_uninit(struct rte_eth_dev *eth_dev) -{ - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; - struct aq_hw_s *hw; - - PMD_INIT_FUNC_TRACE(); - - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; - - hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - - if (hw->adapter_stopped == 0) - atl_dev_close(eth_dev); - - eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; - - /* disable uio intr before callback unregister */ - rte_intr_disable(intr_handle); - rte_intr_callback_unregister(intr_handle, - atl_dev_interrupt_handler, eth_dev); - - rte_free(eth_dev->data->mac_addrs); - eth_dev->data->mac_addrs = NULL; - - return 0; -} - static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) @@ -485,7 +451,7 @@ eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, static int eth_atl_pci_remove(struct rte_pci_device *pci_dev) { - return rte_eth_dev_pci_generic_remove(pci_dev, eth_atl_dev_uninit); + return rte_eth_dev_pci_generic_remove(pci_dev, atl_dev_close); } static int @@ -717,14 +683,36 @@ atl_dev_set_link_down(struct rte_eth_dev *dev) /* * Reset and stop device. */ -static void +static int atl_dev_close(struct rte_eth_dev *dev) { + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct aq_hw_s *hw; + PMD_INIT_FUNC_TRACE(); + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + atl_dev_stop(dev); atl_free_queues(dev); + + dev->dev_ops = NULL; + dev->rx_pkt_burst = NULL; + dev->tx_pkt_burst = NULL; + + /* disable uio intr before callback unregister */ + rte_intr_disable(intr_handle); + rte_intr_callback_unregister(intr_handle, + atl_dev_interrupt_handler, dev); + + pthread_mutex_destroy(&hw->mbox_mutex); + + return 0; } static int @@ -732,7 +720,7 @@ atl_dev_reset(struct rte_eth_dev *dev) { int ret; - ret = eth_atl_dev_uninit(dev); + ret = atl_dev_close(dev); if (ret) return ret; @@ -1393,8 +1381,7 @@ atl_dev_interrupt_action(struct rte_eth_dev *dev, /* Notify userapp if link status changed */ if (!atl_dev_link_update(dev, 0)) { atl_dev_link_status_print(dev); - _rte_eth_dev_callback_process(dev, - RTE_ETH_EVENT_INTR_LSC, NULL); + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } else { if (hw->aq_fw_ops->send_macsec_req == NULL) goto done; @@ -1420,7 +1407,7 @@ atl_dev_interrupt_action(struct rte_eth_dev *dev, resp.stats.egress_expired || resp.stats.ingress_expired) { PMD_DRV_LOG(INFO, "RTE_ETH_EVENT_MACSEC"); - _rte_eth_dev_callback_process(dev, + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_MACSEC, NULL); } } @@ -1925,13 +1912,5 @@ is_atlantic_supported(struct rte_eth_dev *dev) RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map); RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic"); - -RTE_INIT(atl_init_log) -{ - atl_logtype_init = rte_log_register("pmd.net.atlantic.init"); - if (atl_logtype_init >= 0) - rte_log_set_level(atl_logtype_init, RTE_LOG_NOTICE); - atl_logtype_driver = rte_log_register("pmd.net.atlantic.driver"); - if (atl_logtype_driver >= 0) - rte_log_set_level(atl_logtype_driver, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(atl_logtype_init, pmd.net.atlantic.init, NOTICE); +RTE_LOG_REGISTER(atl_logtype_driver, pmd.net.atlantic.driver, NOTICE);