net/i40e: fix multi-queue Rx interrupt for VF
authorLunyuan Cui <lunyuanx.cui@intel.com>
Fri, 17 Jan 2020 08:22:58 +0000 (08:22 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 5 Feb 2020 08:51:21 +0000 (09:51 +0100)
The interrupt vector which bind to queues should not be larger than
the max available vector. It will cause port start failed. This patch
changed the judgement condition of the limited vector id. It can
effectively avoid vector id out of range.

Fixes: 6a6cf5f88b4a ("net/i40e: enable multi-queue Rx interrupt for VF")

Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
drivers/net/i40e/i40e_ethdev_vf.c

index fa2c7de..b846373 100644 (file)
@@ -658,7 +658,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
        struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
        uint32_t vector_id;
        int i, err;
-       uint16_t nb_msix;
 
        if (dev->data->dev_conf.intr_conf.rxq != 0 &&
            rte_intr_allow_others(intr_handle))
@@ -666,9 +665,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
        else
                vector_id = I40E_MISC_VEC_ID;
 
-       nb_msix = RTE_MIN(vf->vf_res->max_vectors,
-                       intr_handle->nb_efd);
-
        map_info = (struct virtchnl_irq_map_info *)cmd_buffer;
        map_info->num_vectors = dev->data->nb_rx_queues;
        for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -683,7 +679,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
                        intr_handle->intr_vec[i] = vector_id;
                if (vector_id > I40E_MISC_VEC_ID)
                        vector_id++;
-               if (vector_id > nb_msix)
+               if (vector_id >= vf->vf_res->max_vectors)
                        vector_id = I40E_RX_VEC_START;
        }