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

Function tap_rx_intr_vec_install

dpdk/drivers/net/tap/tap_intr.c:48–93  ·  view source on GitHub ↗

* Allocate Rx queue interrupt vector and register Rx interrupts. * * @param dev * Pointer to the tap rte_eth_dev device structure. * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

46 * 0 on success, negative errno value otherwise and rte_errno is set.
47 */
48static int
49tap_rx_intr_vec_install(struct rte_eth_dev *dev)
50{
51 struct pmd_internals *pmd = dev->data->dev_private;
52 struct pmd_process_private *process_private = dev->process_private;
53 unsigned int rxqs_n = pmd->dev->data->nb_rx_queues;
54 struct rte_intr_handle *intr_handle = pmd->intr_handle;
55 unsigned int n = RTE_MIN(rxqs_n, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
56 unsigned int i;
57 unsigned int count = 0;
58
59 if (!dev->data->dev_conf.intr_conf.rxq)
60 return 0;
61
62 if (rte_intr_vec_list_alloc(intr_handle, NULL, rxqs_n)) {
63 rte_errno = ENOMEM;
64 TAP_LOG(ERR,
65 "failed to allocate memory for interrupt vector,"
66 " Rx interrupts will not be supported");
67 return -rte_errno;
68 }
69 for (i = 0; i < n; i++) {
70 struct rx_queue *rxq = pmd->dev->data->rx_queues[i];
71
72 /* Skip queues that cannot request interrupts. */
73 if (!rxq || process_private->rxq_fds[i] == -1) {
74 /* Use invalid intr_vec[] index to disable entry. */
75 if (rte_intr_vec_list_index_set(intr_handle, i,
76 RTE_INTR_VEC_RXTX_OFFSET + RTE_MAX_RXTX_INTR_VEC_ID))
77 return -rte_errno;
78 continue;
79 }
80 if (rte_intr_vec_list_index_set(intr_handle, i,
81 RTE_INTR_VEC_RXTX_OFFSET + count))
82 return -rte_errno;
83 if (rte_intr_efds_index_set(intr_handle, count,
84 process_private->rxq_fds[i]))
85 return -rte_errno;
86 count++;
87 }
88 if (!count)
89 tap_rx_intr_vec_uninstall(dev);
90 else if (rte_intr_nb_efd_set(intr_handle, count))
91 return -rte_errno;
92 return 0;
93}
94
95/**
96 * Register or unregister the Rx interrupts.

Callers 1

tap_rx_intr_vec_setFunction · 0.85

Calls 5

rte_intr_vec_list_allocFunction · 0.85
rte_intr_efds_index_setFunction · 0.85
rte_intr_nb_efd_setFunction · 0.85

Tested by

no test coverage detected