MCPcopy Create free account
hub / github.com/F-Stack/f-stack / virtio_dev_stop

Function virtio_dev_stop

dpdk/drivers/net/virtio/virtio_ethdev.c:2508–2548  ·  view source on GitHub ↗

* Stop device: disable interrupt and mark link down */

Source from the content-addressed store, hash-verified

2506 * Stop device: disable interrupt and mark link down
2507 */
2508int
2509virtio_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);
2539out_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
2550static int
2551virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)

Callers 1

eth_virtio_pci_uninitFunction · 0.85

Calls 7

virtio_intr_disableFunction · 0.85
memsetFunction · 0.85
rte_eth_linkstatus_setFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected