Skip to contentSkip to conversation

net/ixgbe: fix VFIO interrupt mapping in PF

PATCH New Wei Dai 3 participants 5 messages Sep 20, 2017 – Jan 22, 2018 Network drivers

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

PATCH 1/1 net/ixgbe: fix VFIO interrupt mapping in PF

When a PF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in ixgbe_dev_init( ).
In ixgbe_dev_start(), if previous VFIO interrupt mapping set in ixgbe_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 0a45657a6794 ("pci: rework interrupt handling")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +9 -0
index 9ca5cbc..9030d3d 100644
@@ -2692,6 +2692,15 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 				     " no intr multiplex");
 	}
 
+	/* When a PF port is bound to VFIO-PCI only miscellaneous interrupt
+	*  is mapped to VFIO vector 0 in ixgbe_dev_init( ).
+	*  If previous VFIO interrupt mapping set in ixgbe_dev_init( ) is
+	*  not cleared, it will fail when following rte_intr_enable( ) tries
+	*  to map Rx queue interrupt to other VFIO vectors.
+	*  So clear uio/vfio intr/evevnfd first to avoid failure.
+	*/
+	rte_intr_disable(intr_handle);
+
 	/* check if rxq interrupt is enabled */
 	if (dev->data->dev_conf.intr_conf.rxq != 0 &&
 	    rte_intr_dp_is_en(intr_handle))
Signature · 1 line
2.7.5
author
#1 lore raw

PATCH 1/1 net/ixgbe: fix VFIO interrupt mapping in PF

When a PF port is bound to VFIO-PIC, only miscellaneous interrupt is mapped to VFIO vector 0 in ixgbe_dev_init( ).
In ixgbe_dev_start(), if previous VFIO interrupt mapping set in ixgbe_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 0a45657a6794 ("pci: rework interrupt handling")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +9 -0
index 9ca5cbc..5292694 100644
@@ -2692,6 +2692,15 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 				     " no intr multiplex");
 	}
 
+	/* When a PF port is bound to VFIO-PCI only miscellaneous interrupt
+	 * is mapped to VFIO vector 0 in ixgbe_dev_init( ).
+	 * If previous VFIO interrupt mapping set in ixgbe_dev_init( ) is
+	 * not cleared, it will fail when following rte_intr_enable( ) tries
+	 * to map Rx queue interrupt to other VFIO vectors.
+	 * So clear uio/vfio intr/evevnfd first to avoid failure.
+	 */
+	rte_intr_disable(intr_handle);
+
 	/* check if rxq interrupt is enabled */
 	if (dev->data->dev_conf.intr_conf.rxq != 0 &&
 	    rte_intr_dp_is_en(intr_handle))
Signature · 1 line
2.7.5
#2 lore raw

Hi Wei,

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_start(struct rte_eth_dev *dev) · line 2702

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
+	rte_intr_disable(intr_handle);

TBH, confused by this patch. I see the intr already disabled at the begining of this function, ixgbe_dev_start, why we need to disable it again?

#3 lore raw

+1 why we disable interrupt in dev_start twice?

Quoted 12 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wenzhuo Lu
Sent: Tuesday, January 9, 2018 4:24 PM
To: Dai, Wei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF

Hi Wei,

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_start(struct rte_eth_dev *dev) · line 2702

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
+	rte_intr_disable(intr_handle);

TBH, confused by this patch. I see the intr already disabled at the begining of this function, ixgbe_dev_start, why we need to disable it again?

author
#4 lore raw

I add this code line to align same style and same action taken in ixgbe VF and i40e VF.
In ixgbe VF or i40e VF, without this line, the initialization of Rx queue interrupt mapping to VFIO-PCI vectors would fail. I have tested it in ixgbe PF port with example/l3fwd-power and
found the interrupt can be initialized successfully and Rx queue can be waked up by incoming packets
no matter whether this line exists or not.
So I decide to reject it now.

Quoted 22 lines

-----Original Message-----
From: Yang, Qiming
Sent: Wednesday, January 10, 2018 2:29 PM
To: Lu, Wenzhuo <[email protected]>; Dai, Wei <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF

+1 why we disable interrupt in dev_start twice?

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wenzhuo Lu
Sent: Tuesday, January 9, 2018 4:24 PM
To: Dai, Wei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF

Quoted 5 lines

Hi Wei,

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_start(struct rte_eth_dev *dev) · line 2702

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
+	rte_intr_disable(intr_handle);

TBH, confused by this patch. I see the intr already disabled at the begining of this function, ixgbe_dev_start, why we need to disable it

again?