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

Function virtio_dev_start

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

Source from the content-addressed store, hash-verified

2329
2330
2331static int
2332virtio_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

Callers

nothing calls this directly

Calls 10

virtio_intr_disableFunction · 0.85
virtio_intr_enableFunction · 0.85
virtqueue_rxvq_flushFunction · 0.85
set_rxtx_funcsFunction · 0.85
virtio_dev_link_updateFunction · 0.85
virtqueue_notifyFunction · 0.70

Tested by

no test coverage detected