| 2498 | } |
| 2499 | |
| 2500 | static int |
| 2501 | i40e_dev_stop(struct rte_eth_dev *dev) |
| 2502 | { |
| 2503 | struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); |
| 2504 | struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 2505 | struct i40e_vsi *main_vsi = pf->main_vsi; |
| 2506 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 2507 | struct rte_intr_handle *intr_handle = pci_dev->intr_handle; |
| 2508 | int i; |
| 2509 | |
| 2510 | if (hw->adapter_stopped == 1) |
| 2511 | return 0; |
| 2512 | |
| 2513 | if (dev->data->dev_conf.intr_conf.rxq == 0) { |
| 2514 | rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev); |
| 2515 | rte_intr_enable(intr_handle); |
| 2516 | } |
| 2517 | |
| 2518 | /* Disable all queues */ |
| 2519 | for (i = 0; i < dev->data->nb_tx_queues; i++) |
| 2520 | i40e_dev_tx_queue_stop(dev, i); |
| 2521 | |
| 2522 | for (i = 0; i < dev->data->nb_rx_queues; i++) |
| 2523 | i40e_dev_rx_queue_stop(dev, i); |
| 2524 | |
| 2525 | /* un-map queues with interrupt registers */ |
| 2526 | i40e_vsi_disable_queues_intr(main_vsi); |
| 2527 | i40e_vsi_queues_unbind_intr(main_vsi); |
| 2528 | |
| 2529 | for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) { |
| 2530 | i40e_vsi_disable_queues_intr(pf->vmdq[i].vsi); |
| 2531 | i40e_vsi_queues_unbind_intr(pf->vmdq[i].vsi); |
| 2532 | } |
| 2533 | |
| 2534 | /* Clear all queues and release memory */ |
| 2535 | i40e_dev_clear_queues(dev); |
| 2536 | |
| 2537 | /* Set link down */ |
| 2538 | i40e_dev_set_link_down(dev); |
| 2539 | |
| 2540 | if (!rte_intr_allow_others(intr_handle)) |
| 2541 | /* resume to the default handler */ |
| 2542 | rte_intr_callback_register(intr_handle, |
| 2543 | i40e_dev_interrupt_handler, |
| 2544 | (void *)dev); |
| 2545 | |
| 2546 | /* Clean datapath event and queue/vec mapping */ |
| 2547 | rte_intr_efd_disable(intr_handle); |
| 2548 | |
| 2549 | /* Cleanup vector list */ |
| 2550 | rte_intr_vec_list_free(intr_handle); |
| 2551 | |
| 2552 | /* reset hierarchy commit */ |
| 2553 | pf->tm_conf.committed = false; |
| 2554 | |
| 2555 | hw->adapter_stopped = 1; |
| 2556 | dev->data->dev_started = 0; |
| 2557 |
no test coverage detected