X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Ffm10k%2Ffm10k_ethdev.c;h=c4a6fdf7f0d85eeb98a14bd230f39b52996a16b8;hb=ac6fcb841b0fef4a42e98cbf7b6181bb4e5be12e;hp=407baa16c364a0296478196ad00466079be927e8;hpb=73fb89dd6a0010eb1435a83a173187688a61a242;p=dpdk.git diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 407baa16c3..c4a6fdf7f0 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -40,19 +40,6 @@ #define GLORT_FD_MASK GLORT_PF_MASK #define GLORT_FD_INDEX GLORT_FD_Q_BASE -int fm10k_logtype_init; -int fm10k_logtype_driver; - -#ifdef RTE_LIBRTE_FM10K_DEBUG_RX -int fm10k_logtype_rx; -#endif -#ifdef RTE_LIBRTE_FM10K_DEBUG_TX -int fm10k_logtype_tx; -#endif -#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE -int fm10k_logtype_tx_free; -#endif - static void fm10k_close_mbx_service(struct fm10k_hw *hw); static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev); static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -1575,28 +1562,9 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) +fm10k_vlan_offload_set(struct rte_eth_dev *dev __rte_unused, + int mask __rte_unused) { - if (mask & ETH_VLAN_STRIP_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP)) - PMD_INIT_LOG(ERR, "VLAN stripping is " - "always on in fm10k"); - } - - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - PMD_INIT_LOG(ERR, "VLAN QinQ is not " - "supported in fm10k"); - } - - if (mask & ETH_VLAN_FILTER_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_FILTER)) - PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); - } - return 0; } @@ -1873,9 +1841,10 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, q->tail_ptr = (volatile uint32_t *) &((uint32_t *)hw->hw_addr)[FM10K_RDT(queue_id)]; q->offloads = offloads; - if (handle_rxconf(q, conf)) + if (handle_rxconf(q, conf)) { + rte_free(q); return -EINVAL; - + } /* allocate memory for the software ring */ q->sw_ring = rte_zmalloc_socket("fm10k sw ring", (nb_desc + q->nb_fake_desc) * sizeof(struct rte_mbuf *), @@ -2055,8 +2024,10 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, q->ops = &def_txq_ops; q->tail_ptr = (volatile uint32_t *) &((uint32_t *)hw->hw_addr)[FM10K_TDT(queue_id)]; - if (handle_txconf(q, conf)) + if (handle_txconf(q, conf)) { + rte_free(q); return -EINVAL; + } /* allocate memory for the software ring */ q->sw_ring = rte_zmalloc_socket("fm10k sw ring", @@ -2653,7 +2624,7 @@ fm10k_dev_interrupt_handler_pf(void *param) true); dev_info->sm_down = 0; - _rte_eth_dev_callback_process(dev, + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } @@ -2667,8 +2638,7 @@ fm10k_dev_interrupt_handler_pf(void *param) if (err == FM10K_ERR_RESET_REQUESTED) { PMD_INIT_LOG(INFO, "INT: Switch is down"); dev_info->sm_down = 1; - _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, - NULL); + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } /* Handle SRAM error */ @@ -2735,8 +2705,7 @@ fm10k_dev_interrupt_handler_vf(void *param) /* Setting reset flag */ dev_info->sm_down = 1; - _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, - NULL); + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } if (dev_info->sm_down == 1 && @@ -2764,8 +2733,7 @@ fm10k_dev_interrupt_handler_vf(void *param) fm10k_vlan_filter_set(dev, hw->mac.default_vid, true); dev_info->sm_down = 0; - _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, - NULL); + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } /* Re-enable interrupt from device side */ @@ -2811,7 +2779,7 @@ fm10k_close_mbx_service(struct fm10k_hw *hw) hw->mbx.ops.disconnect(hw, &hw->mbx); } -static void +static int fm10k_dev_close(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2819,6 +2787,8 @@ fm10k_dev_close(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pdev->intr_handle; PMD_INIT_FUNC_TRACE(); + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; fm10k_mbx_lock(hw); hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map, @@ -2856,6 +2826,8 @@ fm10k_dev_close(struct rte_eth_dev *dev) rte_intr_callback_unregister(intr_handle, fm10k_dev_interrupt_handler_vf, (void *)dev); } + + return 0; } static const struct eth_dev_ops fm10k_eth_dev_ops = { @@ -2887,10 +2859,6 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .rx_queue_release = fm10k_rx_queue_release, .tx_queue_setup = fm10k_tx_queue_setup, .tx_queue_release = fm10k_tx_queue_release, - .rx_queue_count = fm10k_dev_rx_queue_count, - .rx_descriptor_done = fm10k_dev_rx_descriptor_done, - .rx_descriptor_status = fm10k_dev_rx_descriptor_status, - .tx_descriptor_status = fm10k_dev_tx_descriptor_status, .rx_queue_intr_enable = fm10k_dev_rx_queue_intr_enable, .rx_queue_intr_disable = fm10k_dev_rx_queue_intr_disable, .reta_update = fm10k_reta_update, @@ -2958,7 +2926,7 @@ fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, return nb_tx; } -static void __attribute__((cold)) +static void __rte_cold fm10k_set_tx_function(struct rte_eth_dev *dev) { struct fm10k_tx_queue *txq; @@ -3007,7 +2975,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) } } -static void __attribute__((cold)) +static void __rte_cold fm10k_set_rx_function(struct rte_eth_dev *dev) { struct fm10k_dev_info *dev_info = @@ -3087,6 +3055,10 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); dev->dev_ops = &fm10k_eth_dev_ops; + dev->rx_queue_count = fm10k_dev_rx_queue_count; + dev->rx_descriptor_done = fm10k_dev_rx_descriptor_done; + dev->rx_descriptor_status = fm10k_dev_rx_descriptor_status; + dev->tx_descriptor_status = fm10k_dev_tx_descriptor_status; dev->rx_pkt_burst = &fm10k_recv_pkts; dev->tx_pkt_burst = &fm10k_xmit_pkts; dev->tx_pkt_prepare = &fm10k_prep_pkts; @@ -3115,7 +3087,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) hw->hw_addr = (void *)pdev->mem_resource[0].addr; if (hw->hw_addr == NULL) { PMD_INIT_LOG(ERR, "Bad mem resource." - " Try to blacklist unused devices."); + " Try to refuse unused devices."); return -EIO; } @@ -3162,11 +3134,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) &dev->data->mac_addrs[0]); } - /* Pass the information to the rte_eth_dev_close() that it should also - * release the private port resources. - */ - dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; - /* Reset the hw statistics */ diag = fm10k_stats_reset(dev); if (diag != 0) { @@ -3210,19 +3177,19 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Make sure Switch Manager is ready before going forward. */ if (hw->mac.type == fm10k_mac_pf) { - int switch_ready = 0; + bool switch_ready = false; for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) { fm10k_mbx_lock(hw); hw->mac.ops.get_host_state(hw, &switch_ready); fm10k_mbx_unlock(hw); - if (switch_ready) + if (switch_ready == true) break; /* Delay some time to acquire async LPORT_MAP info. */ rte_delay_us(WAIT_SWITCH_MSG_US); } - if (switch_ready == 0) { + if (switch_ready == false) { PMD_INIT_LOG(ERR, "switch is not ready"); return -1; } @@ -3274,14 +3241,7 @@ static int eth_fm10k_dev_uninit(struct rte_eth_dev *dev) { PMD_INIT_FUNC_TRACE(); - - /* only uninitialize in the primary process */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - - /* safe to close dev here */ fm10k_dev_close(dev); - return 0; } @@ -3318,31 +3278,14 @@ static struct rte_pci_driver rte_pmd_fm10k = { RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k); RTE_PMD_REGISTER_PCI_TABLE(net_fm10k, pci_id_fm10k_map); RTE_PMD_REGISTER_KMOD_DEP(net_fm10k, "* igb_uio | uio_pci_generic | vfio-pci"); - -RTE_INIT(fm10k_init_log) -{ - fm10k_logtype_init = rte_log_register("pmd.net.fm10k.init"); - if (fm10k_logtype_init >= 0) - rte_log_set_level(fm10k_logtype_init, RTE_LOG_NOTICE); - fm10k_logtype_driver = rte_log_register("pmd.net.fm10k.driver"); - if (fm10k_logtype_driver >= 0) - rte_log_set_level(fm10k_logtype_driver, RTE_LOG_NOTICE); - +RTE_LOG_REGISTER(fm10k_logtype_init, pmd.net.fm10k.init, NOTICE); +RTE_LOG_REGISTER(fm10k_logtype_driver, pmd.net.fm10k.driver, NOTICE); #ifdef RTE_LIBRTE_FM10K_DEBUG_RX - fm10k_logtype_rx = rte_log_register("pmd.net.fm10k.rx"); - if (fm10k_logtype_rx >= 0) - rte_log_set_level(fm10k_logtype_rx, RTE_LOG_DEBUG); +RTE_LOG_REGISTER(fm10k_logtype_rx, pmd.net.fm10k.rx, DEBUG); #endif - #ifdef RTE_LIBRTE_FM10K_DEBUG_TX - fm10k_logtype_tx = rte_log_register("pmd.net.fm10k.tx"); - if (fm10k_logtype_tx >= 0) - rte_log_set_level(fm10k_logtype_tx, RTE_LOG_DEBUG); +RTE_LOG_REGISTER(fm10k_logtype_tx, pmd.net.fm10k.tx, DEBUG); #endif - #ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE - fm10k_logtype_tx_free = rte_log_register("pmd.net.fm10k.tx_free"); - if (fm10k_logtype_tx_free >= 0) - rte_log_set_level(fm10k_logtype_tx_free, RTE_LOG_DEBUG); +RTE_LOG_REGISTER(fm10k_logtype_tx_free, pmd.net.fm10k.tx_free, DEBUG); #endif -}