| 1352 | } |
| 1353 | |
| 1354 | static int |
| 1355 | virtio_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 | |
| 1409 | static void |
| 1410 | virtio_get_speed_duplex(struct rte_eth_dev *eth_dev, |
no test coverage detected