DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: fix VFIO interrupt mapping in PF
@ 2017-09-20  8:11 Wei Dai
  2017-09-20 10:24 ` Wei Dai
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Dai @ 2017-09-20  8:11 UTC (permalink / raw)
  To: wenzhuo.lu, konstantin.ananyev; +Cc: dev, Wei Dai, stable

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")
Cc: stable@dpdk.org

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 9ca5cbc..9030d3d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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))
-- 
2.7.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH] net/ixgbe: fix VFIO interrupt mapping in PF
  2017-09-20  8:11 [dpdk-dev] [PATCH] net/ixgbe: fix VFIO interrupt mapping in PF Wei Dai
@ 2017-09-20 10:24 ` Wei Dai
  2018-01-09  8:23   ` [dpdk-dev] " Wenzhuo Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Dai @ 2017-09-20 10:24 UTC (permalink / raw)
  To: wenzhuo.lu, konstantin.ananyev; +Cc: dev, Wei Dai, stable

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")
Cc: stable@dpdk.org

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 9ca5cbc..5292694 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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))
-- 
2.7.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
  2017-09-20 10:24 ` Wei Dai
@ 2018-01-09  8:23   ` Wenzhuo Lu
  2018-01-10  6:28     ` Yang, Qiming
  0 siblings, 1 reply; 5+ messages in thread
From: Wenzhuo Lu @ 2018-01-09  8:23 UTC (permalink / raw)
  To: wei.dai; +Cc: dev

Hi Wei,

> +	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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
  2018-01-09  8:23   ` [dpdk-dev] " Wenzhuo Lu
@ 2018-01-10  6:28     ` Yang, Qiming
  2018-01-22  7:03       ` Dai, Wei
  0 siblings, 1 reply; 5+ messages in thread
From: Yang, Qiming @ 2018-01-10  6:28 UTC (permalink / raw)
  To: Lu, Wenzhuo, Dai, Wei; +Cc: dev

+1 why we disable interrupt in dev_start twice?

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 9, 2018 4:24 PM
> To: Dai, Wei <wei.dai@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
> 
> Hi Wei,
> 
> > +	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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
  2018-01-10  6:28     ` Yang, Qiming
@ 2018-01-22  7:03       ` Dai, Wei
  0 siblings, 0 replies; 5+ messages in thread
From: Dai, Wei @ 2018-01-22  7:03 UTC (permalink / raw)
  To: Yang, Qiming, Lu, Wenzhuo; +Cc: dev

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.


> -----Original Message-----
> From: Yang, Qiming
> Sent: Wednesday, January 10, 2018 2:29 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Dai, Wei <wei.dai@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
> 
> +1 why we disable interrupt in dev_start twice?
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 9, 2018 4:24 PM
> > To: Dai, Wei <wei.dai@intel.com>
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] net/ixgbe: fix VFIO interrupt mapping in PF
> >
> > Hi Wei,
> >
> > > +	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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-22  7:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20  8:11 [dpdk-dev] [PATCH] net/ixgbe: fix VFIO interrupt mapping in PF Wei Dai
2017-09-20 10:24 ` Wei Dai
2018-01-09  8:23   ` [dpdk-dev] " Wenzhuo Lu
2018-01-10  6:28     ` Yang, Qiming
2018-01-22  7:03       ` Dai, Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).