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

Function ena_setup_rx_intr

dpdk/drivers/net/ena/ena_ethdev.c:3708–3773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3706}
3707
3708static int ena_setup_rx_intr(struct rte_eth_dev *dev)
3709{
3710 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
3711 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
3712 int rc;
3713 uint16_t vectors_nb, i;
3714 bool rx_intr_requested = dev->data->dev_conf.intr_conf.rxq;
3715
3716 if (!rx_intr_requested)
3717 return 0;
3718
3719 if (!rte_intr_cap_multiple(intr_handle)) {
3720 PMD_DRV_LOG(ERR,
3721 "Rx interrupt requested, but it isn't supported by the PCI driver\n");
3722 return -ENOTSUP;
3723 }
3724
3725 /* Disable interrupt mapping before the configuration starts. */
3726 rte_intr_disable(intr_handle);
3727
3728 /* Verify if there are enough vectors available. */
3729 vectors_nb = dev->data->nb_rx_queues;
3730 if (vectors_nb > RTE_MAX_RXTX_INTR_VEC_ID) {
3731 PMD_DRV_LOG(ERR,
3732 "Too many Rx interrupts requested, maximum number: %d\n",
3733 RTE_MAX_RXTX_INTR_VEC_ID);
3734 rc = -ENOTSUP;
3735 goto enable_intr;
3736 }
3737
3738 /* Allocate the vector list */
3739 if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
3740 dev->data->nb_rx_queues)) {
3741 PMD_DRV_LOG(ERR,
3742 "Failed to allocate interrupt vector for %d queues\n",
3743 dev->data->nb_rx_queues);
3744 rc = -ENOMEM;
3745 goto enable_intr;
3746 }
3747
3748 rc = rte_intr_efd_enable(intr_handle, vectors_nb);
3749 if (rc != 0)
3750 goto free_intr_vec;
3751
3752 if (!rte_intr_allow_others(intr_handle)) {
3753 PMD_DRV_LOG(ERR,
3754 "Not enough interrupts available to use both ENA Admin and Rx interrupts\n");
3755 goto disable_intr_efd;
3756 }
3757
3758 for (i = 0; i < vectors_nb; ++i)
3759 if (rte_intr_vec_list_index_set(intr_handle, i,
3760 RTE_INTR_VEC_RXTX_OFFSET + i))
3761 goto disable_intr_efd;
3762
3763 rte_intr_enable(intr_handle);
3764 return 0;
3765

Callers 1

ena_startFunction · 0.85

Calls 9

rte_intr_vec_list_allocFunction · 0.85
rte_intr_vec_list_freeFunction · 0.85
rte_intr_cap_multipleFunction · 0.50
rte_intr_disableFunction · 0.50
rte_intr_efd_enableFunction · 0.50
rte_intr_allow_othersFunction · 0.50
rte_intr_enableFunction · 0.50
rte_intr_efd_disableFunction · 0.50

Tested by

no test coverage detected