patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF
       [not found] <1509628256-16300-1-git-send-email-wei.dai@intel.com>
@ 2017-11-02 13:10 ` Wei Dai
  2017-11-03  2:25   ` Wu, Jingjing
  2017-11-02 13:10 ` [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue " Wei Dai
       [not found] ` <1509693243-43101-1-git-send-email-wei.dai@intel.com>
  2 siblings, 1 reply; 12+ messages in thread
From: Wei Dai @ 2017-11-02 13:10 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, cunming.liang; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 3b76c9e..567b7d0 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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
-- 
2.7.5

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

* [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF
       [not found] <1509628256-16300-1-git-send-email-wei.dai@intel.com>
  2017-11-02 13:10 ` [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF Wei Dai
@ 2017-11-02 13:10 ` Wei Dai
  2017-11-03  2:17   ` Wu, Jingjing
       [not found] ` <1509693243-43101-1-git-send-email-wei.dai@intel.com>
  2 siblings, 1 reply; 12+ messages in thread
From: Wei Dai @ 2017-11-02 13:10 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, cunming.liang; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 567b7d0..94fb4b1 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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;
 
-- 
2.7.5

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

* Re: [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF
  2017-11-02 13:10 ` [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue " Wei Dai
@ 2017-11-03  2:17   ` Wu, Jingjing
  2017-11-03  5:51     ` Dai, Wei
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Jingjing @ 2017-11-03  2:17 UTC (permalink / raw)
  To: Dai, Wei, Xing, Beilei, Liang, Cunming; +Cc: dev, stable



> -----Original Message-----
> From: Dai, Wei
> Sent: Thursday, November 2, 2017 9:11 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liang, Cunming <cunming.liang@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; stable@dpdk.org
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Dai <wei.dai@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index 567b7d0..94fb4b1 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -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.

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

* Re: [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF
  2017-11-02 13:10 ` [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF Wei Dai
@ 2017-11-03  2:25   ` Wu, Jingjing
  2017-11-03  5:48     ` Dai, Wei
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Jingjing @ 2017-11-03  2:25 UTC (permalink / raw)
  To: Dai, Wei, Xing, Beilei, Liang, Cunming; +Cc: dev, stable



> -----Original Message-----
> From: Dai, Wei
> Sent: Thursday, November 2, 2017 9:11 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liang, Cunming <cunming.liang@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; stable@dpdk.org
> 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?

> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Dai <wei.dai@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index 3b76c9e..567b7d0 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -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.
>  }
> 
>  static int
> --
> 2.7.5

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

* Re: [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF
  2017-11-03  2:25   ` Wu, Jingjing
@ 2017-11-03  5:48     ` Dai, Wei
  0 siblings, 0 replies; 12+ messages in thread
From: Dai, Wei @ 2017-11-03  5:48 UTC (permalink / raw)
  To: Wu, Jingjing, Xing, Beilei, Liang, Cunming; +Cc: dev, stable

Hi, Jingjing
Thanks for your feedback.

> > 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. 
> 
> > 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")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wei Dai <wei.dai@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > b/drivers/net/i40e/i40e_ethdev_vf.c
> > index 3b76c9e..567b7d0 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -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.

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.


> >  }
> >
> >  static int
> > --
> > 2.7.5

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

* Re: [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue interrupt mapping in VF
  2017-11-03  2:17   ` Wu, Jingjing
@ 2017-11-03  5:51     ` Dai, Wei
  0 siblings, 0 replies; 12+ messages in thread
From: Dai, Wei @ 2017-11-03  5:51 UTC (permalink / raw)
  To: Wu, Jingjing, Xing, Beilei, Liang, Cunming; +Cc: dev, stable

Hi, Jingjing 
Thanks for your feedback.
 
> > 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")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wei Dai <wei.dai@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > b/drivers/net/i40e/i40e_ethdev_vf.c
> > index 567b7d0..94fb4b1 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -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.
It looks good using I40E_RX_VEC_START instead of 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.
Yes I have tested it and confirm Rx interrupt is enabled with l3fwd-power.
> 
> 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.
> 

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

* [dpdk-stable] [PATCH v2 1/2] net/i40e: fix VFIO interrupt mapping in VF
       [not found] ` <1509693243-43101-1-git-send-email-wei.dai@intel.com>
@ 2017-11-03  7:14   ` Wei Dai
  2017-11-03  7:14   ` [dpdk-stable] [PATCH v2 2/2] net/i40e: fix Rx queue " Wei Dai
       [not found]   ` <1509698850-13301-1-git-send-email-wei.dai@intel.com>
  2 siblings, 0 replies; 12+ messages in thread
From: Wei Dai @ 2017-11-03  7:14 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, cunming.liang; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 3b76c9e..46dac86 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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:
-- 
2.7.4

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

* [dpdk-stable] [PATCH v2 2/2] net/i40e: fix Rx queue interrupt mapping in VF
       [not found] ` <1509693243-43101-1-git-send-email-wei.dai@intel.com>
  2017-11-03  7:14   ` [dpdk-stable] [PATCH v2 1/2] net/i40e: fix VFIO " Wei Dai
@ 2017-11-03  7:14   ` Wei Dai
       [not found]   ` <1509698850-13301-1-git-send-email-wei.dai@intel.com>
  2 siblings, 0 replies; 12+ messages in thread
From: Wei Dai @ 2017-11-03  7:14 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing, cunming.liang; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 46dac86..70ff3fd 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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;
 
-- 
2.7.4

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

* [dpdk-stable] [PATCH v3 1/2] net/i40e: fix VFIO interrupt mapping in VF
       [not found]   ` <1509698850-13301-1-git-send-email-wei.dai@intel.com>
@ 2017-11-03  8:47     ` Wei Dai
  2017-11-03 10:36       ` Wu, Jingjing
  2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 2/2] net/i40e: fix Rx queue " Wei Dai
  1 sibling, 1 reply; 12+ messages in thread
From: Wei Dai @ 2017-11-03  8:47 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 3b76c9e..f2af022 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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:
-- 
2.7.4

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

* [dpdk-stable] [PATCH v3 2/2] net/i40e: fix Rx queue interrupt mapping in VF
       [not found]   ` <1509698850-13301-1-git-send-email-wei.dai@intel.com>
  2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 1/2] net/i40e: fix VFIO " Wei Dai
@ 2017-11-03  8:47     ` Wei Dai
  2017-11-03 10:37       ` Wu, Jingjing
  1 sibling, 1 reply; 12+ messages in thread
From: Wei Dai @ 2017-11-03  8:47 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, Wei Dai, stable

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

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index f2af022..1118c74 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -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;
 
-- 
2.7.4

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

* Re: [dpdk-stable] [PATCH v3 1/2] net/i40e: fix VFIO interrupt mapping in VF
  2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 1/2] net/i40e: fix VFIO " Wei Dai
@ 2017-11-03 10:36       ` Wu, Jingjing
  0 siblings, 0 replies; 12+ messages in thread
From: Wu, Jingjing @ 2017-11-03 10:36 UTC (permalink / raw)
  To: Dai, Wei, Xing, Beilei; +Cc: dev, stable



> -----Original Message-----
> From: Dai, Wei
> Sent: Friday, November 3, 2017 4:47 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; stable@dpdk.org
> 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.
> 
> Fixes: 4b90a3ff26c5 ("i40evf: support Rx interrupt")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Dai <wei.dai@intel.com>

Acked-by: Jingjing Wu <jingjing.wu@intel.com>

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

* Re: [dpdk-stable] [PATCH v3 2/2] net/i40e: fix Rx queue interrupt mapping in VF
  2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 2/2] net/i40e: fix Rx queue " Wei Dai
@ 2017-11-03 10:37       ` Wu, Jingjing
  0 siblings, 0 replies; 12+ messages in thread
From: Wu, Jingjing @ 2017-11-03 10:37 UTC (permalink / raw)
  To: Dai, Wei, Xing, Beilei; +Cc: dev, stable



> -----Original Message-----
> From: Dai, Wei
> Sent: Friday, November 3, 2017 4:48 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; stable@dpdk.org
> 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.
> 
> Fixes: 4b90a3ff26c5 ("i40evf: support Rx interrupt")
> Fixes: 975ffea6f671 ("net/i40e: remove DPDK PF version specific code")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>

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

end of thread, other threads:[~2017-11-03 10:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1509628256-16300-1-git-send-email-wei.dai@intel.com>
2017-11-02 13:10 ` [dpdk-stable] [PATCH 1/2] net/i40e: fix VFIO interrupt mapping in VF Wei Dai
2017-11-03  2:25   ` Wu, Jingjing
2017-11-03  5:48     ` Dai, Wei
2017-11-02 13:10 ` [dpdk-stable] [PATCH 2/2] net/i40e: fix Rx queue " Wei Dai
2017-11-03  2:17   ` Wu, Jingjing
2017-11-03  5:51     ` Dai, Wei
     [not found] ` <1509693243-43101-1-git-send-email-wei.dai@intel.com>
2017-11-03  7:14   ` [dpdk-stable] [PATCH v2 1/2] net/i40e: fix VFIO " Wei Dai
2017-11-03  7:14   ` [dpdk-stable] [PATCH v2 2/2] net/i40e: fix Rx queue " Wei Dai
     [not found]   ` <1509698850-13301-1-git-send-email-wei.dai@intel.com>
2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 1/2] net/i40e: fix VFIO " Wei Dai
2017-11-03 10:36       ` Wu, Jingjing
2017-11-03  8:47     ` [dpdk-stable] [PATCH v3 2/2] net/i40e: fix Rx queue " Wei Dai
2017-11-03 10:37       ` Wu, Jingjing

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).