| 2048 | } |
| 2049 | |
| 2050 | int |
| 2051 | i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) |
| 2052 | { |
| 2053 | struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); |
| 2054 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 2055 | struct rte_intr_handle *intr_handle = pci_dev->intr_handle; |
| 2056 | struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); |
| 2057 | uint16_t msix_vect = vsi->msix_intr; |
| 2058 | uint16_t nb_msix = RTE_MIN(vsi->nb_msix, |
| 2059 | rte_intr_nb_efd_get(intr_handle)); |
| 2060 | uint16_t queue_idx = 0; |
| 2061 | int record = 0; |
| 2062 | int i; |
| 2063 | |
| 2064 | for (i = 0; i < vsi->nb_qps; i++) { |
| 2065 | I40E_WRITE_REG(hw, I40E_QINT_TQCTL(vsi->base_queue + i), 0); |
| 2066 | I40E_WRITE_REG(hw, I40E_QINT_RQCTL(vsi->base_queue + i), 0); |
| 2067 | } |
| 2068 | |
| 2069 | /* VF bind interrupt */ |
| 2070 | if (vsi->type == I40E_VSI_SRIOV) { |
| 2071 | if (vsi->nb_msix == 0) { |
| 2072 | PMD_DRV_LOG(ERR, "No msix resource"); |
| 2073 | return -EINVAL; |
| 2074 | } |
| 2075 | __vsi_queues_bind_intr(vsi, msix_vect, |
| 2076 | vsi->base_queue, vsi->nb_qps, |
| 2077 | itr_idx); |
| 2078 | return 0; |
| 2079 | } |
| 2080 | |
| 2081 | /* PF & VMDq bind interrupt */ |
| 2082 | if (rte_intr_dp_is_en(intr_handle)) { |
| 2083 | if (vsi->type == I40E_VSI_MAIN) { |
| 2084 | queue_idx = 0; |
| 2085 | record = 1; |
| 2086 | } else if (vsi->type == I40E_VSI_VMDQ2) { |
| 2087 | struct i40e_vsi *main_vsi = |
| 2088 | I40E_DEV_PRIVATE_TO_MAIN_VSI(vsi->adapter); |
| 2089 | queue_idx = vsi->base_queue - main_vsi->nb_qps; |
| 2090 | record = 1; |
| 2091 | } |
| 2092 | } |
| 2093 | |
| 2094 | for (i = 0; i < vsi->nb_used_qps; i++) { |
| 2095 | if (vsi->nb_msix == 0) { |
| 2096 | PMD_DRV_LOG(ERR, "No msix resource"); |
| 2097 | return -EINVAL; |
| 2098 | } else if (nb_msix <= 1) { |
| 2099 | if (!rte_intr_allow_others(intr_handle)) |
| 2100 | /* allow to share MISC_VEC_ID */ |
| 2101 | msix_vect = I40E_MISC_VEC_ID; |
| 2102 | |
| 2103 | /* no enough msix_vect, map all to one */ |
| 2104 | __vsi_queues_bind_intr(vsi, msix_vect, |
| 2105 | vsi->base_queue + i, |
| 2106 | vsi->nb_used_qps - i, |
| 2107 | itr_idx); |
no test coverage detected