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

Function virtio_configure_intr

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

Source from the content-addressed store, hash-verified

1352}
1353
1354static int
1355virtio_configure_intr(struct rte_eth_dev *dev)
1356{
1357 struct virtio_hw *hw = dev->data->dev_private;
1358 int ret;
1359
1360 if (!rte_intr_cap_multiple(dev->intr_handle)) {
1361 PMD_INIT_LOG(ERR, "Multiple intr vector not supported");
1362 return -ENOTSUP;
1363 }
1364
1365 ret = rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues);
1366 if (ret < 0) {
1367 PMD_INIT_LOG(ERR, "Fail to create eventfd");
1368 return ret;
1369 }
1370
1371 ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
1372 hw->max_queue_pairs);
1373 if (ret < 0) {
1374 PMD_INIT_LOG(ERR, "Failed to allocate %u rxq vectors",
1375 hw->max_queue_pairs);
1376 return ret;
1377 }
1378
1379 if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
1380 /* Re-register callback to update max_intr */
1381 rte_intr_callback_unregister(dev->intr_handle,
1382 virtio_interrupt_handler,
1383 dev);
1384 rte_intr_callback_register(dev->intr_handle,
1385 virtio_interrupt_handler,
1386 dev);
1387 }
1388
1389 /* DO NOT try to remove this! This function will enable msix, or QEMU
1390 * will encounter SIGSEGV when DRIVER_OK is sent.
1391 * And for legacy devices, this should be done before queue/vec binding
1392 * to change the config size from 20 to 24, or VIRTIO_MSI_QUEUE_VECTOR
1393 * (22) will be ignored.
1394 */
1395 if (virtio_intr_enable(dev) < 0) {
1396 PMD_DRV_LOG(ERR, "interrupt enable failed");
1397 return -EINVAL;
1398 }
1399
1400 ret = virtio_queues_bind_intr(dev);
1401 if (ret < 0) {
1402 PMD_INIT_LOG(ERR, "Failed to bind queue/interrupt");
1403 return ret;
1404 }
1405
1406 return 0;
1407}
1408
1409static void
1410virtio_get_speed_duplex(struct rte_eth_dev *eth_dev,

Callers 1

virtio_init_deviceFunction · 0.85

Calls 7

rte_intr_vec_list_allocFunction · 0.85
virtio_intr_enableFunction · 0.85
virtio_queues_bind_intrFunction · 0.85
rte_intr_cap_multipleFunction · 0.50
rte_intr_efd_enableFunction · 0.50

Tested by

no test coverage detected