Skip to contentSkip to conversation

net/i40e: fix binding interrupt without msix vectors

PATCH Superseded Jiang Mao 4 participants 16 messages Jun 9, 2020 – Jul 23, 2020 Network drivers

lore
Share & tools
lore

Jiang Mao

author
#0 lore raw

PATCH 1/2 net/i40e: fix binding interrupt without msix vectors

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 41 +++++++++++++++++++++++-----------
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 2 files changed, 29 insertions(+), 14 deletions(-)
drivers/net/i40e/i40e_ethdev.c +28 -13
index 970a31cb2..33ed556c8 100644
@@ -2013,7 +2013,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,
 	I40E_WRITE_FLUSH(hw);
 }
 
-void
+int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 {
 	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2033,10 +2033,14 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 
 	/* VF bind interrupt */
 	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
 		__vsi_queues_bind_intr(vsi, msix_vect,
-				       vsi->base_queue, vsi->nb_qps,
-				       itr_idx);
-		return;
+							   vsi->base_queue, vsi->nb_qps,
+							   itr_idx);
+		return 0;
 	}
 
 	/* PF & VMDq bind interrupt */
@@ -2053,16 +2057,19 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 	}
 
 	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
 			if (!rte_intr_allow_others(intr_handle))
 				/* allow to share MISC_VEC_ID */
 				msix_vect = I40E_MISC_VEC_ID;
 
 			/* no enough msix_vect, map all to one */
 			__vsi_queues_bind_intr(vsi, msix_vect,
-					       vsi->base_queue + i,
-					       vsi->nb_used_qps - i,
-					       itr_idx);
+								   vsi->base_queue + i,
+								   vsi->nb_used_qps - i,
+								   itr_idx);
 			for (; !!record && i < vsi->nb_used_qps; i++)
 				intr_handle->intr_vec[queue_idx + i] =
 					msix_vect;
@@ -2078,6 +2085,8 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 		msix_vect++;
 		nb_msix--;
 	}
+
+	return 0;
 }
 
 static void
@@ -2318,21 +2327,27 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	/* Map queues with MSIX interrupt */
 	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
 		pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	if (ret < 0)
+		return ret;
 	i40e_vsi_enable_queues_intr(main_vsi);
 
 	/* Map VMDQ VSI queues with MSIX interrupt */
 	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
 		pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+										I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
 	}
 
 	/* enable FDIR MSIX interrupt */
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-					  I40E_ITR_INDEX_NONE);
+		ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+										I40E_ITR_INDEX_NONE);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
 	}
 
drivers/net/i40e/i40e_ethdev.h +1 -1
index e5d0ce53f..33fbe776b 100644
@@ -1248,7 +1248,7 @@ void i40e_update_vsi_stats(struct i40e_vsi *vsi);
 void i40e_pf_disable_irq0(struct i40e_hw *hw);
 void i40e_pf_enable_irq0(struct i40e_hw *hw);
 int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
 			   struct i40e_vsi_vlan_pvid_info *info);
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 net/i40e: fix binding interrupt without msix vectors

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++--------
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 2 files changed, 24 insertions(+), 9 deletions(-)
drivers/net/i40e/i40e_ethdev.c +23 -8
index 777e149..16fcb8d 100644
@@ -2001,7 +2001,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	I40E_WRITE_FLUSH(hw);
 }
 
-void
+int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 {
 	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2021,10 +2021,14 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 
 	/* VF bind interrupt */
 	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
 		__vsi_queues_bind_intr(vsi, msix_vect,
 				       vsi->base_queue, vsi->nb_qps,
 				       itr_idx);
-		return;
+		return 0;
 	}
 
 	/* PF & VMDq bind interrupt */
@@ -2041,7 +2045,10 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	}
 
 	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
 			if (!rte_intr_allow_others(intr_handle))
 				/* allow to share MISC_VEC_ID */
 				msix_vect = I40E_MISC_VEC_ID;
@@ -2066,6 +2073,8 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 		msix_vect++;
 		nb_msix--;
 	}
+
+	return 0;
 }
 
 static void
@@ -2306,21 +2315,27 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 	/* Map queues with MSIX interrupt */
 	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
 		pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	if (ret < 0)
+		return ret;
 	i40e_vsi_enable_queues_intr(main_vsi);
 
 	/* Map VMDQ VSI queues with MSIX interrupt */
 	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
 		pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+						I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
 	}
 
 	/* enable FDIR MSIX interrupt */
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-					  I40E_ITR_INDEX_NONE);
+		ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+						I40E_ITR_INDEX_NONE);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
 	}
 
drivers/net/i40e/i40e_ethdev.h +1 -1
index e5d0ce5..33fbe77 100644
@@ -1248,7 +1248,7 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
 void i40e_pf_disable_irq0(struct i40e_hw *hw);
 void i40e_pf_enable_irq0(struct i40e_hw *hw);
 int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
 			   struct i40e_vsi_vlan_pvid_info *info);
Signature · 1 line
1.8.3.1
#2 lore raw

hi, jiang mao

Quoted 5 lines · Jiang Mao

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)

Blank line is need before Signed-off. And please remember --reply-to when you send new version patch to trace the comments.

Quoted 57 lines
---
  drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++--------
  drivers/net/i40e/i40e_ethdev.h |  2 +-
  2 files changed, 24 insertions(+), 9 deletions(-)
drivers/net/i40e/i40e_ethdev.c +12 -3
index 777e149..16fcb8d 100644
@@ -2001,7 +2001,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
  	I40E_WRITE_FLUSH(hw);
  }
 
-void
+int
  i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
  {
  	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2021,10 +2021,14 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
 
  	/* VF bind interrupt */
  	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
  		__vsi_queues_bind_intr(vsi, msix_vect,
  				       vsi->base_queue, vsi->nb_qps,
  				       itr_idx);
-		return;
+		return 0;
  	}
 
  	/* PF & VMDq bind interrupt */
@@ -2041,7 +2045,10 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
  	}
 
  	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
  			if (!rte_intr_allow_others(intr_handle))
  				/* allow to share MISC_VEC_ID */
  				msix_vect = I40E_MISC_VEC_ID;
@@ -2066,6 +2073,8 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
  		msix_vect++;
  		nb_msix--;
  	}
+
+	return 0;
  }
 
  static void

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) · line 2319

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +2 -1
@@ -2306,21 +2315,27 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
  	/* Map queues with MSIX interrupt */
  	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
  		pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	if (ret < 0)

Better to add some print log out of the calling if it is need. Below is the same.

Quoted 39 lines
drivers/net/i40e/i40e_ethdev.c +9 -4
+		return ret;
  	i40e_vsi_enable_queues_intr(main_vsi);
 
  	/* Map VMDQ VSI queues with MSIX interrupt */
  	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
  		pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+						I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
  		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
  	}
 
  	/* enable FDIR MSIX interrupt */
  	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-					  I40E_ITR_INDEX_NONE);
+		ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+						I40E_ITR_INDEX_NONE);
+		if (ret < 0)
+			return ret;
  		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
  	}
 
drivers/net/i40e/i40e_ethdev.h +1 -1
index e5d0ce5..33fbe77 100644
@@ -1248,7 +1248,7 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
  void i40e_pf_disable_irq0(struct i40e_hw *hw);
  void i40e_pf_enable_irq0(struct i40e_hw *hw);
  int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
  void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
  int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
  			   struct i40e_vsi_vlan_pvid_info *info);
#3 lore raw

Thanks Jia. Comments as below.

Quoted 90 lines

-----Original Message-----
From: Guo, Jia
Sent: Tuesday, July 21, 2020 11:58 AM
To: Jiang, MaoX <[email protected]>; Ye, Xiaolong <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: fix binding interrupt without msix vectors

hi, jiang mao

Quoted 5 lines · Jiang Mao

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)

Blank line is need before Signed-off. And please remember --reply-to when you send new version patch to trace the comments.

Review

Quoted 7 lines
---
  drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++--------
  drivers/net/i40e/i40e_ethdev.h |  2 +-
  2 files changed, 24 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct

Quoted 4 lines

index 777e149..16fcb8d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -2001,7 +2001,7 @@ void i40e_flex_payload_reg_set_default(struct

i40e_hw *hw)

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
  	I40E_WRITE_FLUSH(hw);
  }
 
-void
+int
  i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
  {
  	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2021,10 +2021,14 @@ void i40e_flex_payload_reg_set_default(struct

i40e_hw *hw)

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct

Quoted 16 lines
drivers/net/i40e/i40e_ethdev.c +5 -1
  	/* VF bind interrupt */
  	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
  		__vsi_queues_bind_intr(vsi, msix_vect,
  				       vsi->base_queue, vsi->nb_qps,
  				       itr_idx);
-		return;
+		return 0;
  	}
 
  	/* PF & VMDq bind interrupt */
@@ -2041,7 +2045,10 @@ void i40e_flex_payload_reg_set_default(struct

i40e_hw *hw)

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct

Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +4 -1
  	}
 
  	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
  			if (!rte_intr_allow_others(intr_handle))
  				/* allow to share MISC_VEC_ID */
  				msix_vect = I40E_MISC_VEC_ID;
@@ -2066,6 +2073,8 @@ void i40e_flex_payload_reg_set_default(struct

i40e_hw *hw)

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +2 -0
  		msix_vect++;
  		nb_msix--;
  	}
+
+	return 0;
  }
 
  static void
@@ -2306,21 +2315,27 @@ void i40e_flex_payload_reg_set_default(struct

i40e_hw *hw)

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
  	/* Map queues with MSIX interrupt */
  	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
  		pf->nb_cfg_vmdq_vsi *

RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;

Quoted 8 lines

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct · line 2318

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi,

I40E_ITR_INDEX_DEFAULT);

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct · line 2319

Quoted 1 line
drivers/net/i40e/i40e_ethdev.c +1 -0
+	if (ret < 0)

Better to add some print log out of the calling if it is need. Below is the same.

At i40e_vsi_queues_bind_intr(), I have add a print log, I think it`s enough, otherwise it will add too many print log in code.

Quoted 44 lines

drivers/net/i40e/i40e_ethdev.c void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)

Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +1 -0
+		return ret;
  	i40e_vsi_enable_queues_intr(main_vsi);
 
  	/* Map VMDQ VSI queues with MSIX interrupt */
  	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
  		pf->vmdq[i].vsi->nb_used_qps =

RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;

Review

Quoted 21 lines
drivers/net/i40e/i40e_ethdev.c +8 -4
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+						I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
  		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
  	}
 
  	/* enable FDIR MSIX interrupt */
  	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-					  I40E_ITR_INDEX_NONE);
+		ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+						I40E_ITR_INDEX_NONE);
+		if (ret < 0)
+			return ret;
  		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
  	}
 
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h

drivers/net/i40e/i40e_ethdev.h struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, · line 1250

Quoted 7 lines

index e5d0ce5..33fbe77 100644

drivers/net/i40e/i40e_ethdev.h +0 -0
@@ -1248,7 +1248,7 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
  void i40e_pf_disable_irq0(struct i40e_hw *hw);
  void i40e_pf_enable_irq0(struct i40e_hw *hw);
  int i40e_dev_link_update(struct rte_eth_dev *dev, int

wait_to_complete);

Quoted 5 lines
drivers/net/i40e/i40e_ethdev.h +1 -1
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
  void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
  int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
  			   struct i40e_vsi_vlan_pvid_info *info);
author
#4 lore raw

PATCH v3 1/2 net/i40e: fix binding interrupt without msix vectors

In reply to Jiang Mao

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)

---
V3: fix format issue.

---
 drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++--------
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 2 files changed, 24 insertions(+), 9 deletions(-)
drivers/net/i40e/i40e_ethdev.c +23 -8
index 777e14926f..16fcb8d24e 100644
@@ -2001,7 +2001,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,
 	I40E_WRITE_FLUSH(hw);
 }
 
-void
+int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 {
 	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2021,10 +2021,14 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 
 	/* VF bind interrupt */
 	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
 		__vsi_queues_bind_intr(vsi, msix_vect,
 				       vsi->base_queue, vsi->nb_qps,
 				       itr_idx);
-		return;
+		return 0;
 	}
 
 	/* PF & VMDq bind interrupt */
@@ -2041,7 +2045,10 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 	}
 
 	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
 			if (!rte_intr_allow_others(intr_handle))
 				/* allow to share MISC_VEC_ID */
 				msix_vect = I40E_MISC_VEC_ID;
@@ -2066,6 +2073,8 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 		msix_vect++;
 		nb_msix--;
 	}
+
+	return 0;
 }
 
 static void
@@ -2306,21 +2315,27 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	/* Map queues with MSIX interrupt */
 	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
 		pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	if (ret < 0)
+		return ret;
 	i40e_vsi_enable_queues_intr(main_vsi);
 
 	/* Map VMDQ VSI queues with MSIX interrupt */
 	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
 		pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+						I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
 	}
 
 	/* enable FDIR MSIX interrupt */
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-					  I40E_ITR_INDEX_NONE);
+		ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+						I40E_ITR_INDEX_NONE);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
 	}
 
drivers/net/i40e/i40e_ethdev.h +1 -1
index e5d0ce53f5..33fbe776bb 100644
@@ -1248,7 +1248,7 @@ void i40e_update_vsi_stats(struct i40e_vsi *vsi);
 void i40e_pf_disable_irq0(struct i40e_hw *hw);
 void i40e_pf_enable_irq0(struct i40e_hw *hw);
 int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
 			   struct i40e_vsi_vlan_pvid_info *info);
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v3 2/2 net/i40e: fix fdir allocating msix resource error

Fdir allocating msix resource is not strictly necessary, if no resource left, jump the error.

Fixes 4861cde461 (i40e: new poll mode driver)

---
V3: Move type I40E_VSI_FDIR branch into !I40E_VSI_SRIOV branch.

---
 drivers/net/i40e/i40e_ethdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +7 -3
index 16fcb8d24e..c19bf868ea 100644
@@ -5736,10 +5736,14 @@ i40e_vsi_setup(struct i40e_pf *pf,
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "VSI %d get heap failed %d", vsi->seid, ret);
-			goto fail_queue_alloc;
+			if (type != I40E_VSI_FDIR)
+				goto fail_queue_alloc;
+			vsi->msix_intr = 0;
+			vsi->nb_msix = 0;
+		} else {
+			vsi->msix_intr = ret;
+			vsi->nb_msix = 1;
 		}
-		vsi->msix_intr = ret;
-		vsi->nb_msix = 1;
 	} else {
 		vsi->msix_intr = 0;
 		vsi->nb_msix = 0;
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH v4 2/2 net/i40e: fix fdir allocating msix resource error

Fdir allocating msix resource is not strictly necessary, if no resource left, jump the error.

Fixes 4861cde461 (i40e: new poll mode driver)

---
V3: Move type I40E_VSI_FDIR branch into !I40E_VSI_SRIOV branch.
V4: Rebase this patch.

---
 drivers/net/i40e/i40e_ethdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +7 -3
index 0c32e451c5..f9a8e7132f 100644
@@ -5839,10 +5839,14 @@ i40e_vsi_setup(struct i40e_pf *pf,
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "VSI %d get heap failed %d", vsi->seid, ret);
-			goto fail_queue_alloc;
+			if (type != I40E_VSI_FDIR)
+				goto fail_queue_alloc;
+			vsi->msix_intr = 0;
+			vsi->nb_msix = 0;
+		} else {
+			vsi->msix_intr = ret;
+			vsi->nb_msix = 1;
 		}
-		vsi->msix_intr = ret;
-		vsi->nb_msix = 1;
 	} else {
 		vsi->msix_intr = 0;
 		vsi->nb_msix = 0;
Signature · 1 line
2.17.1
Acked-by on v4 2/2 Applied
#7 lore raw

Re: [dpdk-dev] [PATCH v4 2/2] net/i40e: fix fdir allocating msix resource error

Quoted 9 lines

-----Original Message-----
From: Jiang, MaoX <[email protected]>
Sent: Friday, July 24, 2020 12:12 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]; Jiang, MaoX <[email protected]>
Subject: [PATCH v4 2/2] net/i40e: fix fdir allocating msix resource error

Quoted 7 lines

Fdir allocating msix resource is not strictly necessary, if no resource left, jump the error.

Fixes 4861cde461 (i40e: new poll mode driver)

Applied to dpdk-next-net-intel.

Thanks
Qi

author
#8 lore raw

PATCH v4 1/2 net/i40e: fix binding interrupt without msix vectors

In reply to Jiang Mao

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)

---
V3: Fix format issue.
V4: Rebase this patch.

---
 drivers/net/i40e/i40e_ethdev.c | 25 +++++++++++++++++++------
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 2 files changed, 20 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_ethdev.c +19 -6
index 05d5f28615..0c32e451c5 100644
@@ -2117,7 +2117,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,
 	I40E_WRITE_FLUSH(hw);
 }
 
-void
+int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 {
 	struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2137,10 +2137,14 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 
 	/* VF bind interrupt */
 	if (vsi->type == I40E_VSI_SRIOV) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		}
 		__vsi_queues_bind_intr(vsi, msix_vect,
 				       vsi->base_queue, vsi->nb_qps,
 				       itr_idx);
-		return;
+		return 0;
 	}
 
 	/* PF & VMDq bind interrupt */
@@ -2157,7 +2161,10 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 	}
 
 	for (i = 0; i < vsi->nb_used_qps; i++) {
-		if (nb_msix <= 1) {
+		if (vsi->nb_msix == 0) {
+			PMD_DRV_LOG(ERR, "No msix resource");
+			return -EINVAL;
+		} else if (nb_msix <= 1) {
 			if (!rte_intr_allow_others(intr_handle))
 				/* allow to share MISC_VEC_ID */
 				msix_vect = I40E_MISC_VEC_ID;
@@ -2182,6 +2189,8 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 		msix_vect++;
 		nb_msix--;
 	}
+
+	return 0;
 }
 
 void
@@ -2422,14 +2431,18 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	/* Map queues with MSIX interrupt */
 	main_vsi->nb_used_qps = dev->data->nb_rx_queues -
 		pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+	if (ret < 0)
+		return ret;
 	i40e_vsi_enable_queues_intr(main_vsi);
 
 	/* Map VMDQ VSI queues with MSIX interrupt */
 	for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
 		pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-		i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
-					  I40E_ITR_INDEX_DEFAULT);
+		ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+						I40E_ITR_INDEX_DEFAULT);
+		if (ret < 0)
+			return ret;
 		i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
 	}
 
drivers/net/i40e/i40e_ethdev.h +1 -1
index aef88abed0..19f821829a 100644
@@ -1319,7 +1319,7 @@ void i40e_update_vsi_stats(struct i40e_vsi *vsi);
 void i40e_pf_disable_irq0(struct i40e_hw *hw);
 void i40e_pf_enable_irq0(struct i40e_hw *hw);
 int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 void i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
Signature · 1 line
2.17.1
Acked-by on v4 1/2 Applied
#9 lore raw
Quoted 9 lines

-----Original Message-----
From: Jiang, MaoX <[email protected]>
Sent: Thursday, July 23, 2020 11:27 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]; Jiang, MaoX <[email protected]>
Subject: [PATCH v4 1/2] net/i40e: fix binding interrupt without msix vectors

Quoted 7 lines

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)

Applied to dpdk-next-net-intel.

Thanks
Qi

Tested-by on v1 1/2
#10 lore raw
In reply to Jiang Mao

Regards,
HuangZhiMin

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jiang Mao
Sent: Tuesday, June 9, 2020 10:26 AM
To: Ye, Xiaolong <[email protected]>
Cc: [email protected]; [email protected]; Jiang, MaoX <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] net/i40e: fix binding interrupt without msix vectors

The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 41 +++++++++++++++++++++++-----------
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 2 files changed, 29 insertions(+), 14 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -2013,7 +2013,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,
 	I40E_WRITE_FLUSH(hw);
 }
 
-void
+int
 i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)  {
 	struct rte_eth_dev *dev = vsi->adapter->eth_dev; @@ -2033,10 +2033,14 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
 

/* VF bind interrupt */
if (vsi->type == I40E_VSI_SRIOV) {
+ if (vsi->nb_msix == 0) {
+ PMD_DRV_LOG(ERR, "No msix resource");
+ return -EINVAL;
+ }
__vsi_queues_bind_intr(vsi, msix_vect,
- vsi->base_queue, vsi->nb_qps,
- itr_idx);
- return;
+ vsi->base_queue, vsi->nb_qps,
+ itr_idx);
+ return 0;
}

/* PF & VMDq bind interrupt */
@@ -2053,16 +2057,19 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
}

for (i = 0; i < vsi->nb_used_qps; i++) {
- if (nb_msix <= 1) {
+ if (vsi->nb_msix == 0) {
+ PMD_DRV_LOG(ERR, "No msix resource");
+ return -EINVAL;
+ } else if (nb_msix <= 1) {
if (!rte_intr_allow_others(intr_handle))
/* allow to share MISC_VEC_ID */ msix_vect = I40E_MISC_VEC_ID;

/* no enough msix_vect, map all to one */ __vsi_queues_bind_intr(vsi, msix_vect,

-					       vsi->base_queue + i,
-					       vsi->nb_used_qps - i,
-					       itr_idx);
+								   vsi->base_queue + i,
+								   vsi->nb_used_qps - i,
+								   itr_idx);

for (; !!record && i < vsi->nb_used_qps; i++)
intr_handle->intr_vec[queue_idx + i] =
msix_vect;
@@ -2078,6 +2085,8 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
msix_vect++;
nb_msix--;
}
+
+ return 0;
}

static void
@@ -2318,21 +2327,27 @@ i40e_dev_start(struct rte_eth_dev *dev)
/* Map queues with MSIX interrupt */ main_vsi->nb_used_qps = dev->data->nb_rx_queues -
pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
- i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+ ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT);
+ if (ret < 0)
+ return ret;
i40e_vsi_enable_queues_intr(main_vsi);

/* Map VMDQ VSI queues with MSIX interrupt */
for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
- i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
- I40E_ITR_INDEX_DEFAULT);
+ ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi,
+ I40E_ITR_INDEX_DEFAULT);
+ if (ret < 0)
+ return ret;
i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
}

/* enable FDIR MSIX interrupt */
if (pf->fdir.fdir_vsi) {
- i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
- I40E_ITR_INDEX_NONE);
+ ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
+ I40E_ITR_INDEX_NONE);
+ if (ret < 0)
+ return ret;
i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
}

drivers/net/i40e/i40e_ethdev.h +1 -1
@@ -1248,7 +1248,7 @@ void i40e_update_vsi_stats(struct i40e_vsi *vsi);  void i40e_pf_disable_irq0(struct i40e_hw *hw);  void i40e_pf_enable_irq0(struct i40e_hw *hw);  int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); -void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
+int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);  int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
 			   struct i40e_vsi_vlan_pvid_info *info);
--

2.17.1

author
#11 lore raw

PATCH 2/2 net/i40e: fix fdir allocating msix resource error

In reply to Jiang Mao

Fdir allocating msix resource is not strictly necessary, if no resource left, print a warning message.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/i40e/i40e_ethdev.c +11 -0
index 33ed556c8..acc43077d 100644
@@ -5744,6 +5744,17 @@ i40e_vsi_setup(struct i40e_pf *pf,
 			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) {
Signature · 1 line
2.17.1
Tested-by on v1 2/2
#12 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir allocating msix resource error

Regards,
HuangZhiMin

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jiang Mao
Sent: Tuesday, June 9, 2020 10:26 AM
To: Ye, Xiaolong <[email protected]>
Cc: [email protected]; [email protected]; Jiang, MaoX <[email protected]>
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)
---
 drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/i40e/i40e_ethdev.c +11 -0
@@ -5744,6 +5744,17 @@ i40e_vsi_setup(struct i40e_pf *pf,
 			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) {

--
2.17.1

author
#13 lore raw

PATCH 2/2 net/i40e: fix fdir allocating msix resource error

In reply to Jiang Mao

Fdir allocating msix resource is not strictly necessary, if no resource left, print a warning message.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/i40e/i40e_ethdev.c +11 -0
index 16fcb8d..885b637 100644
@@ -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) {
Signature · 1 line
1.8.3.1
#14 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir allocating msix resource error

Quoted 29 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Jiang Mao
Sent: Thursday, July 9, 2020 3:53 AM
To: Ye, Xiaolong <[email protected]>
Cc: [email protected]; [email protected]; Jiang, MaoX <[email protected]>
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)
---
 drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/i40e/i40e_ethdev.c +2 -0
index 16fcb8d..885b637 100644
@@ -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);

drivers/net/i40e/i40e_ethdev.c struct i40e_vsi * · line 5746

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +9 -0
+		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

Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 	} else if (type != I40E_VSI_SRIOV) {
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);

if (ret < 0) {
--
1.8.3.1

author
#15 lore raw

PATCH 1/1 net/i40e: fix fdir allocating msix resource error

In reply to Jiang Mao

Fdir allocating msix resource is not strictly necessary, if no resource left, jump the error.

Fixes 4861cde461 (i40e: new poll mode driver)
---
 drivers/net/i40e/i40e_ethdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

---
V2: Move type I40E_VSI_FDIR branch into !I40E_VSI_SRIOV branch.

drivers/net/i40e/i40e_ethdev.c +7 -3
index 777e14926f..a606409172 100644
@@ -5721,10 +5721,14 @@ i40e_vsi_setup(struct i40e_pf *pf,
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "VSI %d get heap failed %d", vsi->seid, ret);
-			goto fail_queue_alloc;
+			if (type != I40E_VSI_FDIR)
+				goto fail_queue_alloc;
+			vsi->msix_intr = 0;
+			vsi->nb_msix = 0;
+		} else {
+			vsi->msix_intr = ret;
+			vsi->nb_msix = 1;
 		}
-		vsi->msix_intr = ret;
-		vsi->nb_msix = 1;
 	} else {
 		vsi->msix_intr = 0;
 		vsi->nb_msix = 0;
Signature · 1 line
2.17.1