| 2329 | |
| 2330 | |
| 2331 | static int |
| 2332 | virtio_dev_start(struct rte_eth_dev *dev) |
| 2333 | { |
| 2334 | uint16_t nb_queues, i; |
| 2335 | struct virtqueue *vq; |
| 2336 | struct virtio_hw *hw = dev->data->dev_private; |
| 2337 | int ret; |
| 2338 | |
| 2339 | /* Finish the initialization of the queues */ |
| 2340 | for (i = 0; i < dev->data->nb_rx_queues; i++) { |
| 2341 | ret = virtio_dev_rx_queue_setup_finish(dev, i); |
| 2342 | if (ret < 0) |
| 2343 | return ret; |
| 2344 | } |
| 2345 | for (i = 0; i < dev->data->nb_tx_queues; i++) { |
| 2346 | ret = virtio_dev_tx_queue_setup_finish(dev, i); |
| 2347 | if (ret < 0) |
| 2348 | return ret; |
| 2349 | } |
| 2350 | |
| 2351 | /* check if lsc interrupt feature is enabled */ |
| 2352 | if (dev->data->dev_conf.intr_conf.lsc) { |
| 2353 | if (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) { |
| 2354 | PMD_DRV_LOG(ERR, "link status not supported by host"); |
| 2355 | return -ENOTSUP; |
| 2356 | } |
| 2357 | } |
| 2358 | |
| 2359 | /* Enable uio/vfio intr/eventfd mapping: although we already did that |
| 2360 | * in device configure, but it could be unmapped when device is |
| 2361 | * stopped. |
| 2362 | */ |
| 2363 | if (dev->data->dev_conf.intr_conf.lsc || |
| 2364 | dev->data->dev_conf.intr_conf.rxq) { |
| 2365 | virtio_intr_disable(dev); |
| 2366 | |
| 2367 | /* Setup interrupt callback */ |
| 2368 | if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) |
| 2369 | rte_intr_callback_register(dev->intr_handle, |
| 2370 | virtio_interrupt_handler, |
| 2371 | dev); |
| 2372 | |
| 2373 | if (virtio_intr_enable(dev) < 0) { |
| 2374 | PMD_DRV_LOG(ERR, "interrupt enable failed"); |
| 2375 | return -EIO; |
| 2376 | } |
| 2377 | } |
| 2378 | |
| 2379 | /*Notify the backend |
| 2380 | *Otherwise the tap backend might already stop its queue due to fullness. |
| 2381 | *vhost backend will have no chance to be waked up |
| 2382 | */ |
| 2383 | nb_queues = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues); |
| 2384 | if (hw->max_queue_pairs > 1) { |
| 2385 | if (virtio_set_multiple_queues(dev, nb_queues) != 0) |
| 2386 | return -EINVAL; |
| 2387 | } |
| 2388 |
nothing calls this directly
no test coverage detected