| 138 | } |
| 139 | |
| 140 | int |
| 141 | sfc_intr_start(struct sfc_adapter *sa) |
| 142 | { |
| 143 | struct sfc_intr *intr = &sa->intr; |
| 144 | struct rte_intr_handle *intr_handle; |
| 145 | struct rte_pci_device *pci_dev; |
| 146 | int rc; |
| 147 | |
| 148 | sfc_log_init(sa, "entry"); |
| 149 | |
| 150 | /* |
| 151 | * The EFX common code event queue module depends on the interrupt |
| 152 | * module. Ensure that the interrupt module is always initialized |
| 153 | * (even if interrupts are not used). Status memory is required |
| 154 | * for Siena only and may be NULL for EF10. |
| 155 | */ |
| 156 | sfc_log_init(sa, "efx_intr_init"); |
| 157 | rc = efx_intr_init(sa->nic, intr->type, NULL); |
| 158 | if (rc != 0) |
| 159 | goto fail_intr_init; |
| 160 | |
| 161 | pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev); |
| 162 | intr_handle = pci_dev->intr_handle; |
| 163 | |
| 164 | if (intr->handler != NULL) { |
| 165 | if (intr->rxq_intr && rte_intr_cap_multiple(intr_handle)) { |
| 166 | uint32_t intr_vector; |
| 167 | |
| 168 | intr_vector = sa->eth_dev->data->nb_rx_queues; |
| 169 | rc = rte_intr_efd_enable(intr_handle, intr_vector); |
| 170 | if (rc != 0) |
| 171 | goto fail_rte_intr_efd_enable; |
| 172 | } |
| 173 | if (rte_intr_dp_is_en(intr_handle)) { |
| 174 | if (rte_intr_vec_list_alloc(intr_handle, |
| 175 | "intr_vec", |
| 176 | sa->eth_dev->data->nb_rx_queues)) { |
| 177 | sfc_err(sa, |
| 178 | "Failed to allocate %d rx_queues intr_vec", |
| 179 | sa->eth_dev->data->nb_rx_queues); |
| 180 | goto fail_intr_vector_alloc; |
| 181 | } |
| 182 | |
| 183 | } |
| 184 | |
| 185 | sfc_log_init(sa, "rte_intr_callback_register"); |
| 186 | rc = rte_intr_callback_register(intr_handle, intr->handler, |
| 187 | (void *)sa); |
| 188 | if (rc != 0) { |
| 189 | sfc_err(sa, |
| 190 | "cannot register interrupt handler (rc=%d)", |
| 191 | rc); |
| 192 | /* |
| 193 | * Convert error code from negative returned by RTE API |
| 194 | * to positive used in the driver. |
| 195 | */ |
| 196 | rc = -rc; |
| 197 | goto fail_rte_intr_cb_reg; |
no test coverage detected