Skip to contentSkip to conversation

Fix 2 bugs of i40e VF interrupt found in l3fwd-power

PATCH Superseded Wei Dai 4 participants 18 messages Nov 2, 2017 – Nov 3, 2017 Network drivers

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

cover Fix 2 bugs of i40e VF interrupt found in l3fwd-power

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure() failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18
This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt.
Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"), to change VFIO MSI-X interrupts mapping, previous mapping should be cleared first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following 2nd bug: l3fwd-power still can not be waked up by incoming packets.

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"), the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

Wei Dai (2):
net/i40e: fix VFIO interrupt mapping in VF
net/i40e: fix Rx queue interrupt mapping in VF

 drivers/net/i40e/i40e_ethdev_vf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.5
author
#1 lore raw

PATCH 1/2 net/i40e: fix VFIO interrupt mapping in VF

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In ixgbevf_dev_interrupt_handler( ), if previous VFIO interrupt mapping set in i40evf_dev_init( ) is not cleard, it will fail when calling rte_intr_enable( ) tries to map Rx queue interrupt to other VFIO vectors. This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid failure.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +2 -1
index 3b76c9e..567b7d0 100644
@@ -1432,8 +1432,9 @@ i40evf_dev_interrupt_handler(void *param)
 				   " do nothing");
 
 done:
-	i40evf_enable_irq0(hw);
+	rte_intr_disable(dev->intr_handle);
 	rte_intr_enable(dev->intr_handle);
+	i40evf_enable_irq0(hw);
 }
 
 static int
Signature · 1 line
2.7.5
#2 lore raw

Re: [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF

Quoted 10 lines

-----Original Message-----
From: Dai, Wei
Sent: Thursday, November 2, 2017 9:11 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liang, Cunming <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF

Quoted 3 lines

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In ixgbevf_dev_interrupt_handler( ), if previous VFIO interrupt mapping set in

Ixgbevf? Should be i40evf?

Quoted 19 lines

i40evf_dev_init( ) is not cleard, it will fail when calling rte_intr_enable( ) tries to map Rx queue interrupt to other VFIO vectors. This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid failure.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 3b76c9e..567b7d0 100644

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_interrupt_handler(void *param) · line 1437

Quoted 7 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -1
@@ -1432,8 +1432,9 @@ i40evf_dev_interrupt_handler(void *param)
 				   " do nothing");
 
 done:
-	i40evf_enable_irq0(hw);
+	rte_intr_disable(dev->intr_handle);
 	rte_intr_enable(dev->intr_handle);
+	i40evf_enable_irq0(hw);

If that reason, you can move the rte_intr_disable to dev_start when deal with the rxq setting in intr_conf.

Quoted 5 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -1
 }
 
 static int
--

2.7.5

author
#3 lore raw

Re: [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF

Hi, Jingjing
Thanks for your feedback.

Quoted 8 lines
Quoted 6 lines

Subject: [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In ixgbevf_dev_interrupt_handler( ), if previous VFIO interrupt mapping set in

Ixgbevf? Should be i40evf?

Yes, it is my typo error, it should be i40evf.

Quoted 23 lines
Quoted 5 lines

i40evf_dev_init( ) is not cleard, it will fail when calling rte_intr_enable( ) tries to map Rx queue interrupt to other VFIO vectors. This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid

failure.

Quoted 17 lines
Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 3b76c9e..567b7d0 100644
@@ -1432,8 +1432,9 @@ i40evf_dev_interrupt_handler(void *param)
 				   " do nothing");
 
Quoted 8 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_dev_interrupt_handler(void *param) · line 1437

Quoted 5 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -1
 done:
-	i40evf_enable_irq0(hw);
+	rte_intr_disable(dev->intr_handle);
 	rte_intr_enable(dev->intr_handle);
+	i40evf_enable_irq0(hw);

If that reason, you can move the rte_intr_disable to dev_start when deal with the rxq setting in intr_conf.

Yes, I have followed your suggestion and tested it with my following code change. it works well.
The function rte_intr_disable( ) can be moved into i40evf_dev_start( ) and only be called it if rx queue interrupt is enabled.
Meanwhile, the calling of rte_intr_enable( ) in i40evf_dev_interrupt_handle( ) and i40evf_dev_rx_queue_intr_enable( ) can also be removed.

Quoted 5 lines
Quoted 5 lines
drivers/net/i40e/i40e_ethdev_vf.c +0 -1
 }
 
 static int
--

2.7.5

author
#4 lore raw

PATCH 2/2 net/i40e: fix Rx queue interrupt mapping in VF

In reply to Wei Dai

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will be missed.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 567b7d0..94fb4b1 100644
@@ -654,7 +654,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
 	int i, err;
 
 	if (rte_intr_allow_others(intr_handle))
-		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR_LNX;
+		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR;
 	else
 		vector_id = I40E_MISC_VEC_ID;
 
Signature · 1 line
2.7.5
#5 lore raw

Re: [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF

Quoted 34 lines

-----Original Message-----
From: Dai, Wei
Sent: Thursday, November 2, 2017 9:11 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liang, Cunming <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will be missed.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 567b7d0..94fb4b1 100644

drivers/net/i40e/i40e_ethdev_vf.c i40evf_config_irq_map(struct rte_eth_dev *dev) · line 657

Quoted 5 lines
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
@@ -654,7 +654,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
 	int i, err;
 
 	if (rte_intr_allow_others(intr_handle))
-		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR_LNX;
+		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR;

Firstly, We can use I40E_MISC_VEC_ID and I40E_RX_VEC_START to replace I40EVF_VSI_DEFAULT_MSIX_INTR_LNX and I40EVF_VSI_DEFAULT_MSIX_INTR.

You need to check if rx interrupt is enabled or not, if not we should use I40E_MISC_VEC_ID. If rx interrupt is enabled, and rte_intr_allow_others(intr_handle) is true, then use I40E_RX_VEC_START.

And I think in VFIO cases, we can use more than one interrupt for the IRQ mapping. You can refer to the function i40e_vsi_queues_bind_intr.

author
#6 lore raw

Re: [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF

Hi, Jingjing
Thanks for your feedback.

Quoted 29 lines
Quoted 10 lines

Subject: [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will

be missed.

Quoted 18 lines
Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 567b7d0..94fb4b1 100644
@@ -654,7 +654,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
 	int i, err;
 
Quoted 7 lines

drivers/net/i40e/i40e_ethdev_vf.c i40evf_config_irq_map(struct rte_eth_dev *dev) · line 657

Quoted 3 lines
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
 	if (rte_intr_allow_others(intr_handle))
-		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR_LNX;
+		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR;

Firstly, We can use I40E_MISC_VEC_ID and I40E_RX_VEC_START to replace I40EVF_VSI_DEFAULT_MSIX_INTR_LNX and I40EVF_VSI_DEFAULT_MSIX_INTR.

It looks good using I40E_RX_VEC_START instead of I40EVF_VSI_DEFAULT_MSIX_INTR.

Quoted 5 lines

You need to check if rx interrupt is enabled or not, if not we should use I40E_MISC_VEC_ID.
If rx interrupt is enabled, and rte_intr_allow_others(intr_handle) is true, then use I40E_RX_VEC_START.

Yes I have tested it and confirm Rx interrupt is enabled with l3fwd-power.

Quoted 4 lines

And I think in VFIO cases, we can use more than one interrupt for the IRQ mapping. You can refer to the function i40e_vsi_queues_bind_intr.

author
#7 lore raw

v2 cover Fix 2 bugs of i40e VF interrupt found in l3fwd-power

In reply to Wei Dai

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure() failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18
This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt.
Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"), to change VFIO MSI-X interrupts mapping, previous mapping should be cleared first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following 2nd bug: l3fwd-power still can not be waked up by incoming packets.

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"), the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

These patches have passed test with l3fwd-power using i40e VF bound to VFIO-PCI. They also passed the test with testpmd rxonly and txonly mode with igb_uio and VFIO-PCI.

---
v2: only remap VFIO interrupt in i40evf_dev_start( )

Wei Dai (2):
net/i40e: fix VFIO interrupt mapping in VF
net/i40e: fix Rx queue interrupt mapping in VF

 drivers/net/i40e/i40e_ethdev_vf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v2 1/2 net/i40e: fix VFIO interrupt mapping in VF

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In i40evf_dev_interrupt_handle( ) and i40evf_dev_rx_queue_intr_enable( ), if previous VFIO interrupt mapping set in i40evf_dev_init( ) is not cleared, it will fail when PMD tries to map Rx queue interrupt to other VFIO vectors by calling rte_intr_enable( ).
This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid failure. And remove the calling of rte_intr_enable( ) in i40evf_dev_interrupt_handle( ) and i40evf_dev_rx_queue_intr_enable( ) as VFIO interrupt mapping can only be set in i40e_dev_start( ) and it is not necessary to be set in above 2 functions repeatedly.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +13 -3
index 3b76c9e..46dac86 100644
@@ -1433,7 +1433,6 @@ i40evf_dev_interrupt_handler(void *param)
 
 done:
 	i40evf_enable_irq0(hw);
-	rte_intr_enable(dev->intr_handle);
 }
 
 static int
@@ -1888,8 +1887,6 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 
 	I40EVF_WRITE_FLUSH(hw);
 
-	rte_intr_enable(&pci_dev->intr_handle);
-
 	return 0;
 }
 
@@ -2041,7 +2038,20 @@ i40evf_dev_start(struct rte_eth_dev *dev)
 		goto err_mac;
 	}
 
+	/* When a VF port is bound to VFIO-PCI, only miscellaneous interrupt
+	 * is mapped to VFIO vector 0 in i40evf_dev_init( ).
+	 * If previous VFIO interrupt mapping set in i40evf_dev_init( ) is
+	 * not cleared, it will fail when rte_intr_enable( ) tries to map Rx
+	 * queue interrupt to other VFIO vectors.
+	 * So clear uio/vfio intr/evevnfd first to avoid failure.
+	 */
+	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+		rte_intr_disable(intr_handle);
+		rte_intr_enable(intr_handle);
+	}
+
 	i40evf_enable_queues_intr(dev);
+
 	return 0;
 
 err_mac:
Signature · 1 line
2.7.4
author
#9 lore raw

PATCH v2 2/2 net/i40e: fix Rx queue interrupt mapping in VF

In reply to Wei Dai

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will be missed.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 46dac86..70ff3fd 100644
@@ -654,7 +654,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
 	int i, err;
 
 	if (rte_intr_allow_others(intr_handle))
-		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR_LNX;
+		vector_id = I40E_RX_VEC_START;
 	else
 		vector_id = I40E_MISC_VEC_ID;
 
Signature · 1 line
2.7.4
Tested-by on the v2 series
#10 lore raw
In reply to Wei Dai
Quoted 38 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Friday, November 3, 2017 3:14 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liang, Cunming <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v2 0/2] Fix 2 bugs of i40e VF interrupt found in l3fwd-power

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure() failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18
This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt.
Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"),
to change VFIO MSI-X interrupts mapping, previous mapping should be cleared
first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following
2nd bug: l3fwd-power still can not be waked up by incoming packets.

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"),
the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

Quoted 6 lines

These patches have passed test with l3fwd-power using i40e VF bound to VFIO-PCI.
They also passed the test with testpmd rxonly and txonly mode with igb_uio and VFIO-PCI.

Quoted 9 lines

---
v2: only remap VFIO interrupt in i40evf_dev_start( )

Wei Dai (2):
net/i40e: fix VFIO interrupt mapping in VF
net/i40e: fix Rx queue interrupt mapping in VF

Quoted 5 lines
 drivers/net/i40e/i40e_ethdev_vf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

--
2.7.4

Following test case is tested and passed with this patch. L3fwd-power with 1 i40e PF (vfio-pci) can receive interrupt L3fwd-power with 1 i40e VF (vfio-pci) can receive interrupt L3fwd-power with 2 i40e VF (vfio-pci) can receive interrupt

OS: Ubuntu 16.04
CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
NIC: Ethernet Controller X710

author
#11 lore raw

v3 cover Fix 2 bugs of i40e VF interrupt found in l3fwd-power

In reply to Wei Dai

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure() failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18
This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt.
Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"), to change VFIO MSI-X interrupts mapping, previous mapping should be cleared first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following 2nd bug: l3fwd-power still can not be waked up by incoming packets.

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"), the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

These patches have passed test with l3fwd-power using i40e VF bound to VFIO-PCI. They also passed the test with testpmd rxonly and txonly mode with igb_uio and VFIO-PCI.

---
v3:
keep rte_intr_enable( ) for safety and align the style with other PMD. remove 2 unsed macros.

v2:
only remap VFIO interrupt in i40evf_dev_start( )

Wei Dai (2):
net/i40e: fix VFIO interrupt mapping in VF
net/i40e: fix Rx queue interrupt mapping in VF

 drivers/net/i40e/i40e_ethdev_vf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#12 lore raw

PATCH v3 1/2 net/i40e: fix VFIO interrupt mapping in VF

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In i40evf_dev_interrupt_handle( ) and i40evf_dev_rx_queue_intr_enable( ), if previous VFIO interrupt mapping set in i40evf_dev_init( ) is not cleared, it will fail when PMD tries to map Rx queue interrupt to other VFIO vectors by calling rte_intr_enable( ).
This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid failure. And remove the calling of rte_intr_enable( ) in i40evf_dev_interrupt_handler( ) as there is no need to map VFIO interrupt in this function repeatedly.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +13 -1
index 3b76c9e..f2af022 100644
@@ -1433,7 +1433,6 @@ i40evf_dev_interrupt_handler(void *param)
 
 done:
 	i40evf_enable_irq0(hw);
-	rte_intr_enable(dev->intr_handle);
 }
 
 static int
@@ -2041,7 +2040,20 @@ i40evf_dev_start(struct rte_eth_dev *dev)
 		goto err_mac;
 	}
 
+	/* When a VF port is bound to VFIO-PCI, only miscellaneous interrupt
+	 * is mapped to VFIO vector 0 in i40evf_dev_init( ).
+	 * If previous VFIO interrupt mapping set in i40evf_dev_init( ) is
+	 * not cleared, it will fail when rte_intr_enable( ) tries to map Rx
+	 * queue interrupt to other VFIO vectors.
+	 * So clear uio/vfio intr/evevnfd first to avoid failure.
+	 */
+	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+		rte_intr_disable(intr_handle);
+		rte_intr_enable(intr_handle);
+	}
+
 	i40evf_enable_queues_intr(dev);
+
 	return 0;
 
 err_mac:
Signature · 1 line
2.7.4
Acked-by on v3 1/2
#13 lore raw

Re: [PATCH v3 1/2] net/i40e: fix VFIO interrupt mapping in VF

Quoted 21 lines

-----Original Message-----
From: Dai, Wei
Sent: Friday, November 3, 2017 4:47 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH v3 1/2] net/i40e: fix VFIO interrupt mapping in VF

When a VF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in i40evf_dev_init( ).
In i40evf_dev_interrupt_handle( ) and i40evf_dev_rx_queue_intr_enable( ), if previous VFIO interrupt mapping set in i40evf_dev_init( ) is not cleared, it will fail when PMD tries to map Rx queue interrupt to other VFIO vectors by calling rte_intr_enable( ).
This patch clears the VFIO interrupt mappings before setting both miscellaneous and Rx queue interrupt mappings again to avoid failure. And remove the calling of rte_intr_enable( ) in i40evf_dev_interrupt_handler( ) as there is no need to map VFIO interrupt in this function repeatedly.

Quoted 4 lines
Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
author
#14 lore raw

PATCH v3 2/2 net/i40e: fix Rx queue interrupt mapping in VF

In reply to Wei Dai

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will be missed.
Also remove 2 unsed macro definitions.

Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
---
 drivers/net/i40e/i40e_ethdev_vf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +1 -3
index f2af022..1118c74 100644
@@ -68,8 +68,6 @@
 #include "i40e_rxtx.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
-#define I40EVF_VSI_DEFAULT_MSIX_INTR     1
-#define I40EVF_VSI_DEFAULT_MSIX_INTR_LNX 0
 
 /* busy wait delay in msec */
 #define I40EVF_BUSY_WAIT_DELAY 10
@@ -654,7 +652,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev)
 	int i, err;
 
 	if (rte_intr_allow_others(intr_handle))
-		vector_id = I40EVF_VSI_DEFAULT_MSIX_INTR_LNX;
+		vector_id = I40E_RX_VEC_START;
 	else
 		vector_id = I40E_MISC_VEC_ID;
 
Signature · 1 line
2.7.4
Acked-by on v3 2/2
#15 lore raw

Re: [PATCH v3 2/2] net/i40e: fix Rx queue interrupt mapping in VF

Quoted 21 lines

-----Original Message-----
From: Dai, Wei
Sent: Friday, November 3, 2017 4:48 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH v3 2/2] net/i40e: fix Rx queue interrupt mapping in VF

When a VF port is bound to VFIO-PCI, miscellaneous interrupt is mapped to MSI-X vector 0 and Rx queues interrupt are mapped to other vectors in vfio_enable_msix( ). To simplify implementation, all VFIO-PCI bound i40e VF Rx queue interrupts can be mapped in vector 1. And as current igb_uio only support only one vector, i40e VF PMD should use vector 0 for igb_uio and vector 1 for VFIO-PCI. Without this patch, VF Rx queue interrupt is mapped to vector 0 in register settings and mapped to VFIO vector 1 in vfio_enable_msix( ), and then all Rx queue interrupts will be missed.
Also remove 2 unsed macro definitions.

Quoted 5 lines
Fixes 4b90a3ff26c5 ("i40evf: support Rx interrupt")
Fixes 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
author
#16 lore raw
In reply to Wei Dai
Quoted 39 lines

-----Original Message-----
From: Dai, Wei
Sent: Friday, November 3, 2017 4:47 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>
Subject: [PATCH v3 0/2] Fix 2 bugs of i40e VF interrupt found in l3fwd-power

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure()
failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18 This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt. Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"), to change VFIO MSI-X interrupts mapping, previous mapping should be cleared first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following 2nd bug: l3fwd-power still can not be waked up by incoming packets.

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"), the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

These patches have passed test with l3fwd-power using i40e VF bound to VFIO-PCI.
They also passed the test with testpmd rxonly and txonly mode with igb_uio and VFIO-PCI.

Quoted 6 lines

---
v3:
keep rte_intr_enable( ) for safety and align the style with other PMD.

Keep rte_intr_enable( ) in i40evf_dev_rx_queue_intr_enable( ) for safety And align the style with other PMD.

Quoted 14 lines

remove 2 unsed macros.

v2:
only remap VFIO interrupt in i40evf_dev_start( )

Wei Dai (2):
net/i40e: fix VFIO interrupt mapping in VF
net/i40e: fix Rx queue interrupt mapping in VF

 drivers/net/i40e/i40e_ethdev_vf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

--
2.7.4

Acked-by Jingjing Wu on the v3 series
#17 lore raw
In reply to Wei Dai
Quoted 19 lines · Wei Dai

These 2 bugs can be observed from example/l3fwd-power run with i40e VF bound to VFIO-PCI. The test steps are as follows:
1. Disable LSC interrupt by clearing port_conf.intr_conf.lsc=0, as i40e VF doesn't support LSC interrupt to avoid rte_eth_dev_configure() failure.
2. Create a VF from i40e host PF. Let PF run with kernel driver and bind its VF to VFIO-PCI
3. Run l3fwd-power like: l3fwd-power -l 18-19 -- -p 0x1 --config='(0,0,19)'

Then, the following error message appears like:
EAL: Error enabling MSI-X interrupts for fd 18
This error is from rte_intr_enable( )/vfio_enable_msix( ) when enabling Rx queue interrupt.
Same as the patch 06938770186a ("net/ixgbe: fix VFIO interrupt mapping in VF"), to change VFIO MSI-X interrupts mapping, previous mapping should be cleared first to avoid above error.

After fixing above VFIO-PCI MSI-X interrupt mapping. There is still the following 2nd bug: l3fwd-power still can not be waked up by incoming packets.

Quoted 8 lines

Same as the patch ca9d6597184b ("net/ixgbe: fix Rx queue interrupt mapping in VF"), the interrupt vector of Rx queues should be mapped to vector 1 to fix above 2nd bug.

These patches have passed test with l3fwd-power using i40e VF bound to VFIO-PCI. They also passed the test with testpmd rxonly and txonly mode with igb_uio and VFIO-PCI.

Series applied to dpdk-next-net/master, thanks.