* Stop device: disable interrupt and mark link down */
| 2506 | * Stop device: disable interrupt and mark link down |
| 2507 | */ |
| 2508 | int |
| 2509 | virtio_dev_stop(struct rte_eth_dev *dev) |
| 2510 | { |
| 2511 | struct virtio_hw *hw = dev->data->dev_private; |
| 2512 | struct rte_eth_link link; |
| 2513 | struct rte_eth_intr_conf *intr_conf = &dev->data->dev_conf.intr_conf; |
| 2514 | uint16_t i; |
| 2515 | |
| 2516 | PMD_INIT_LOG(DEBUG, "stop"); |
| 2517 | dev->data->dev_started = 0; |
| 2518 | |
| 2519 | rte_spinlock_lock(&hw->state_lock); |
| 2520 | if (!hw->started) |
| 2521 | goto out_unlock; |
| 2522 | hw->started = 0; |
| 2523 | |
| 2524 | virtio_tx_completed_cleanup(dev); |
| 2525 | |
| 2526 | if (intr_conf->lsc || intr_conf->rxq) { |
| 2527 | virtio_intr_disable(dev); |
| 2528 | |
| 2529 | /* Reset interrupt callback */ |
| 2530 | if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { |
| 2531 | rte_intr_callback_unregister(dev->intr_handle, |
| 2532 | virtio_interrupt_handler, |
| 2533 | dev); |
| 2534 | } |
| 2535 | } |
| 2536 | |
| 2537 | memset(&link, 0, sizeof(link)); |
| 2538 | rte_eth_linkstatus_set(dev, &link); |
| 2539 | out_unlock: |
| 2540 | rte_spinlock_unlock(&hw->state_lock); |
| 2541 | |
| 2542 | for (i = 0; i < dev->data->nb_rx_queues; i++) |
| 2543 | dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; |
| 2544 | for (i = 0; i < dev->data->nb_tx_queues; i++) |
| 2545 | dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; |
| 2546 | |
| 2547 | return 0; |
| 2548 | } |
| 2549 | |
| 2550 | static int |
| 2551 | virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) |
no test coverage detected