net/iavf: fix vector id assignment
Checks
Commit Message
From: YU DAPENG <dapengx.yu@intel.com>
When the interrupt handle instance allows none packet I/O interrupts,
the max value of vector_id is set to be less than the number of msix
interrupts, but not equal to it. Which may cause same vector_id is sent
to PF with opcode VIRTCHNL_OP_CONFIG_IRQ_MAP to setup the cause of
interrupt mapping in iavf_config_irq_map(), these are invalid
parameters, cause error: VIRTCHNL_STATUS_ERR_PARAM(-5). So add code to
set the max value of vector_id to be equal to the number of msix
interrupts.
Fixes: d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: YU DAPENG <dapengx.yu@intel.com>
---
drivers/net/iavf/iavf_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Tested-by: Xie,WeiX < weix.xie@intel.com>
Regards,
Xie Wei
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> dapengx.yu@intel.com
> Sent: Wednesday, December 30, 2020 2:54 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix vector id assignment
>
> From: YU DAPENG <dapengx.yu@intel.com>
>
> When the interrupt handle instance allows none packet I/O interrupts, the
> max value of vector_id is set to be less than the number of msix interrupts,
> but not equal to it. Which may cause same vector_id is sent to PF with
> opcode VIRTCHNL_OP_CONFIG_IRQ_MAP to setup the cause of interrupt
> mapping in iavf_config_irq_map(), these are invalid parameters, cause error:
> VIRTCHNL_STATUS_ERR_PARAM(-5). So add code to set the max value of
> vector_id to be equal to the number of msix interrupts.
>
> Fixes: d6bde6b5eae9 ("net/avf: enable Rx interrupt")
> Cc: stable@dpdk.org
>
> Signed-off-by: YU DAPENG <dapengx.yu@intel.com>
> ---
> drivers/net/iavf/iavf_ethdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 7e3c26a94..54ea3a36c 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -578,7 +578,7 @@ static int iavf_config_rx_queues_irqs(struct
> rte_eth_dev *dev,
> qv_map[i].queue_id = i;
> qv_map[i].vector_id = vec;
> intr_handle->intr_vec[i] = vec++;
> - if (vec >= vf->nb_msix)
> + if (vec > vf->nb_msix)
> vec = IAVF_RX_VEC_START;
> }
> vf->qv_map = qv_map;
> --
> 2.27.0
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of dapengx.yu@intel.com
> Sent: Wednesday, December 30, 2020 2:54 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix vector id assignment
>
> From: YU DAPENG <dapengx.yu@intel.com>
>
> When the interrupt handle instance allows none packet I/O interrupts, the max
> value of vector_id is set to be less than the number of msix interrupts, but not
> equal to it. Which may cause same vector_id is sent to PF with opcode
> VIRTCHNL_OP_CONFIG_IRQ_MAP to setup the cause of interrupt mapping in
> iavf_config_irq_map(), these are invalid parameters, cause error:
> VIRTCHNL_STATUS_ERR_PARAM(-5). So add code to set the max value of
> vector_id to be equal to the number of msix interrupts.
>
> Fixes: d6bde6b5eae9 ("net/avf: enable Rx interrupt")
> Cc: stable@dpdk.org
>
> Signed-off-by: YU DAPENG <dapengx.yu@intel.com>
> ---
> drivers/net/iavf/iavf_ethdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index
> 7e3c26a94..54ea3a36c 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -578,7 +578,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev
> *dev,
> qv_map[i].queue_id = i;
> qv_map[i].vector_id = vec;
> intr_handle->intr_vec[i] = vec++;
> - if (vec >= vf->nb_msix)
> + if (vec > vf->nb_msix)
This is not correct, the nb_msix should already include the vector 0, we should not set a vector_id to a value that >= nb_msix,
> vec = IAVF_RX_VEC_START;
> }
> vf->qv_map = qv_map;
> --
> 2.27.0
Hi Qi,
By checking the running i40e vf PMD(function:i40evf_config_irq_map()), found that the vector_id actually can be a value that is equal to nb_msix as the following.
map_info->num_vectors is just equal to nb_msix(which is 2), the max vector_id is also 2. The map_info which contains vecmap[0], and vectmap[1] is sent to PF with opcode VIRTCHNL_OP_CONFIG_IRQ_MAP to setup the cause of interrupt mapping in iavf_config_irq_map(), these are valid parameters and effective at last. The interrupt can run as expected.
So I deduce that vector_id can be equal to nb_msix in iavf PMD too.
(gdb) p *map_info
$6 = {num_vectors = 2, vecmap = {{vsi_id = 10, vector_id = 1, rxq_map = 1, txq_map = 0, rxitr_idx = 0,
txitr_idx = 0}}}
(gdb) p map_info->vecmap[1]
$7 = {vsi_id = 10, vector_id = 2, rxq_map = 2, txq_map = 0, rxitr_idx = 0, txitr_idx = 0}
(gdb) p map_info->vecmap[0]
$8 = {vsi_id = 10, vector_id = 1, rxq_map = 1, txq_map = 0, rxitr_idx = 0, txitr_idx = 0}
-----Original Message-----
From: Zhang, Qi Z
Sent: Monday, January 4, 2021 8:26 AM
To: Yu, DapengX <dapengx.yu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
Subject: RE: [dpdk-dev] [PATCH] net/iavf: fix vector id assignment
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of dapengx.yu@intel.com
> Sent: Wednesday, December 30, 2020 2:54 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix vector id assignment
>
> From: YU DAPENG <dapengx.yu@intel.com>
>
> When the interrupt handle instance allows none packet I/O interrupts,
> the max value of vector_id is set to be less than the number of msix
> interrupts, but not equal to it. Which may cause same vector_id is
> sent to PF with opcode VIRTCHNL_OP_CONFIG_IRQ_MAP to setup the cause
> of interrupt mapping in iavf_config_irq_map(), these are invalid parameters, cause error:
> VIRTCHNL_STATUS_ERR_PARAM(-5). So add code to set the max value of
> vector_id to be equal to the number of msix interrupts.
>
> Fixes: d6bde6b5eae9 ("net/avf: enable Rx interrupt")
> Cc: stable@dpdk.org
>
> Signed-off-by: YU DAPENG <dapengx.yu@intel.com>
> ---
> drivers/net/iavf/iavf_ethdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/iavf/iavf_ethdev.c
> b/drivers/net/iavf/iavf_ethdev.c index 7e3c26a94..54ea3a36c 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -578,7 +578,7 @@ static int iavf_config_rx_queues_irqs(struct
> rte_eth_dev *dev,
> qv_map[i].queue_id = i;
> qv_map[i].vector_id = vec;
> intr_handle->intr_vec[i] = vec++;
> - if (vec >= vf->nb_msix)
> + if (vec > vf->nb_msix)
This is not correct, the nb_msix should already include the vector 0, we should not set a vector_id to a value that >= nb_msix,
> vec = IAVF_RX_VEC_START;
> }
> vf->qv_map = qv_map;
> --
> 2.27.0
@@ -578,7 +578,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
qv_map[i].queue_id = i;
qv_map[i].vector_id = vec;
intr_handle->intr_vec[i] = vec++;
- if (vec >= vf->nb_msix)
+ if (vec > vf->nb_msix)
vec = IAVF_RX_VEC_START;
}
vf->qv_map = qv_map;