[2/2] net/i40e: fix fdir allocating msix resource error

Message ID 20200708195239.4543-1-maox.jiang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers
Series [1/2] net/i40e: fix binding interrupt without msix vectors |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jiang Mao July 8, 2020, 7:52 p.m. UTC
  Fdir allocating msix resource is not strictly necessary, if no
resource left, print a warning message.

Fixes: 4861cde461 (i40e: new poll mode driver)
Cc: stable@dpdk.org
Signed-off-by: Jiang Mao <maox.jiang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Comments

Qi Zhang July 20, 2020, 10:31 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jiang Mao
> Sent: Thursday, July 9, 2020 3:53 AM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Jiang, MaoX <maox.jiang@intel.com>
> Subject: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir allocating msix resource error
> 
> Fdir allocating msix resource is not strictly necessary, if no resource left, print a
> warning message.
> 
> Fixes: 4861cde461 (i40e: new poll mode driver)
> Cc: stable@dpdk.org
> Signed-off-by: Jiang Mao <maox.jiang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 16fcb8d..885b637 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -5732,6 +5732,17 @@ struct i40e_vsi *
>  			vsi->nb_msix = RTE_MIN(vsi->nb_qps,
>  					       RTE_MAX_RXTX_INTR_VEC_ID);
>  		}
> +	} else if (type == I40E_VSI_FDIR) {
> +		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
> +		if (ret < 0) {
> +			PMD_DRV_LOG(WARNING, "MSIX vectors used up, FDIR can`t
> bind interrupt");
> +			vsi->msix_intr = 0;
> +			vsi->nb_msix = 0;
> +		} else {
> +			vsi->msix_intr = ret;
> +			vsi->nb_msix = 1;
> +		}
> +

Better to merge above branch into below branch and remove the "else" branch

>  	} else if (type != I40E_VSI_SRIOV) {
>  		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
>  		if (ret < 0) {
> --
> 1.8.3.1
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 16fcb8d..885b637 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5732,6 +5732,17 @@  struct i40e_vsi *
 			vsi->nb_msix = RTE_MIN(vsi->nb_qps,
 					       RTE_MAX_RXTX_INTR_VEC_ID);
 		}
+	} else if (type == I40E_VSI_FDIR) {
+		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
+		if (ret < 0) {
+			PMD_DRV_LOG(WARNING, "MSIX vectors used up, FDIR can`t bind interrupt");
+			vsi->msix_intr = 0;
+			vsi->nb_msix = 0;
+		} else {
+			vsi->msix_intr = ret;
+			vsi->nb_msix = 1;
+		}
+
 	} else if (type != I40E_VSI_SRIOV) {
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
 		if (ret < 0) {