[v2,3/4] net/iavf: fix restart of Rx queue on reconfigure

Message ID 20230831123337.871496-4-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series Fix i40e/iavf queue reconfig and restarting |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Aug. 31, 2023, 12:33 p.m. UTC
  After reconfiguring an RX queue the mbuf_initializer value was not being
correctly set. Fix this by calling the appropriate function if vector
processing is enabled. This mirrors the behaviour by the i40e driver.

Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
Cc: jingjing.wu@intel.com
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Qi Zhang Sept. 4, 2023, 1:15 a.m. UTC | #1
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, August 31, 2023 8:34 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; stable@dpdk.org
> Subject: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on reconfigure
> 
> After reconfiguring an RX queue the mbuf_initializer value was not being
> correctly set. Fix this by calling the appropriate function if vector processing is
> enabled. This mirrors the behaviour by the i40e driver.
> 
> Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
> Cc: jingjing.wu@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/net/iavf/iavf_rxtx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index
> f7df4665d1..797cdda4b2 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -755,6 +755,13 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev,
> uint16_t queue_idx,
>  	if (check_rx_vec_allow(rxq) == false)
>  		ad->rx_vec_allowed = false;
> 
> +#if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM
> +	/* check vector conflict */
> +	if (ad->rx_vec_allowed && iavf_rxq_vec_setup(rxq)) {
> +		PMD_DRV_LOG(ERR, "Failed vector rx setup.");
> +		return -EINVAL;
> +	}
> +#endif

Bruce:

	May I know more details about how to reproduce this issue?
	As the iavf PMD does not support RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP (i40e does)
	Which indicates before we call rte_eth_rx_queue_setup, the device must be stopped (the flag will be checked in rte_eth_rx_queue_setup)

	So if we do below steps

	rte_eth_dev_stop ..
	rte_eth_rx_queue_setup
	rte_eth_dev_start

	the iavf_rxq_vec_setup should be invoked in rte_eth_dev_start -> iavf_set_rx_function 

	anything I missed?

Thanks
Qi

>  	return 0;
>  }
> 
> --
> 2.39.2
  
Qi Zhang Sept. 4, 2023, 1:30 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Monday, September 4, 2023 9:15 AM
> To: Bruce Richardson <bruce.richardson@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on reconfigure
> 
> 
> 
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Thursday, August 31, 2023 8:34 PM
> > To: dev@dpdk.org
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on
> > reconfigure
> >
> > After reconfiguring an RX queue the mbuf_initializer value was not
> > being correctly set. Fix this by calling the appropriate function if
> > vector processing is enabled. This mirrors the behaviour by the i40e driver.
> >
> > Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
> > Cc: jingjing.wu@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  drivers/net/iavf/iavf_rxtx.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/iavf/iavf_rxtx.c
> > b/drivers/net/iavf/iavf_rxtx.c index
> > f7df4665d1..797cdda4b2 100644
> > --- a/drivers/net/iavf/iavf_rxtx.c
> > +++ b/drivers/net/iavf/iavf_rxtx.c
> > @@ -755,6 +755,13 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev,
> > uint16_t queue_idx,
> >  	if (check_rx_vec_allow(rxq) == false)
> >  		ad->rx_vec_allowed = false;
> >
> > +#if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM
> > +	/* check vector conflict */
> > +	if (ad->rx_vec_allowed && iavf_rxq_vec_setup(rxq)) {
> > +		PMD_DRV_LOG(ERR, "Failed vector rx setup.");
> > +		return -EINVAL;
> > +	}
> > +#endif
> 
> Bruce:
> 
> 	May I know more details about how to reproduce this issue?
> 	As the iavf PMD does not support
> RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP (i40e does)

OK, not sure if the patch 4/4 answered my question ๐Ÿ˜Š

should I squash patch 3, 4 into one? , for my understanding patch 3 doesn't appear to be a bug fix unless we announce RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP.



> 	Which indicates before we call rte_eth_rx_queue_setup, the device
> must be stopped (the flag will be checked in rte_eth_rx_queue_setup)
> 
> 	So if we do below steps
> 
> 	rte_eth_dev_stop ..
> 	rte_eth_rx_queue_setup
> 	rte_eth_dev_start
> 
> 	the iavf_rxq_vec_setup should be invoked in rte_eth_dev_start ->
> iavf_set_rx_function
> 
> 	anything I missed?
> 
> Thanks
> Qi
> 
> >  	return 0;
> >  }
> >
> > --
> > 2.39.2
  
Bruce Richardson Sept. 4, 2023, 7:54 a.m. UTC | #3
On Mon, Sep 04, 2023 at 02:30:32AM +0100, Zhang, Qi Z wrote:
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Monday, September 4, 2023 9:15 AM
> > To: Bruce Richardson <bruce.richardson@intel.com>; dev@dpdk.org
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; stable@dpdk.org
> > Subject: RE: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on reconfigure
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Bruce Richardson <bruce.richardson@intel.com>
> > > Sent: Thursday, August 31, 2023 8:34 PM
> > > To: dev@dpdk.org
> > > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>; stable@dpdk.org
> > > Subject: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on
> > > reconfigure
> > >
> > > After reconfiguring an RX queue the mbuf_initializer value was not
> > > being correctly set. Fix this by calling the appropriate function if
> > > vector processing is enabled. This mirrors the behaviour by the i40e driver.
> > >
> > > Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
> > > Cc: jingjing.wu@intel.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > ---
> > >  drivers/net/iavf/iavf_rxtx.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/drivers/net/iavf/iavf_rxtx.c
> > > b/drivers/net/iavf/iavf_rxtx.c index
> > > f7df4665d1..797cdda4b2 100644
> > > --- a/drivers/net/iavf/iavf_rxtx.c
> > > +++ b/drivers/net/iavf/iavf_rxtx.c
> > > @@ -755,6 +755,13 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev,
> > > uint16_t queue_idx,
> > >  	if (check_rx_vec_allow(rxq) == false)
> > >  		ad->rx_vec_allowed = false;
> > >
> > > +#if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM
> > > +	/* check vector conflict */
> > > +	if (ad->rx_vec_allowed && iavf_rxq_vec_setup(rxq)) {
> > > +		PMD_DRV_LOG(ERR, "Failed vector rx setup.");
> > > +		return -EINVAL;
> > > +	}
> > > +#endif
> > 
> > Bruce:
> > 
> > 	May I know more details about how to reproduce this issue?
> > 	As the iavf PMD does not support
> > RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP (i40e does)
> 
> OK, not sure if the patch 4/4 answered my question ๐Ÿ˜Š
> 
> should I squash patch 3, 4 into one? , for my understanding patch 3 doesn't appear to be a bug fix unless we announce RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP.
> 
You may have a point. I was experimenting with queue reconfiguration which
is where I hit this issue.
However, even without queue reconfig support, the device still needs to
support queue-stop followed by queue-start, I think, and there may still be
an issue there - I'll have to check.

/Bruce
  
Qi Zhang Sept. 5, 2023, 12:02 a.m. UTC | #4
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Monday, September 4, 2023 3:54 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; stable@dpdk.org
> Subject: Re: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on reconfigure
> 
> On Mon, Sep 04, 2023 at 02:30:32AM +0100, Zhang, Qi Z wrote:
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z
> > > Sent: Monday, September 4, 2023 9:15 AM
> > > To: Bruce Richardson <bruce.richardson@intel.com>; dev@dpdk.org
> > > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>; stable@dpdk.org
> > > Subject: RE: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on
> > > reconfigure
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Bruce Richardson <bruce.richardson@intel.com>
> > > > Sent: Thursday, August 31, 2023 8:34 PM
> > > > To: dev@dpdk.org
> > > > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Wu, Jingjing
> > > > <jingjing.wu@intel.com>; stable@dpdk.org
> > > > Subject: [PATCH v2 3/4] net/iavf: fix restart of Rx queue on
> > > > reconfigure
> > > >
> > > > After reconfiguring an RX queue the mbuf_initializer value was not
> > > > being correctly set. Fix this by calling the appropriate function
> > > > if vector processing is enabled. This mirrors the behaviour by the i40e
> driver.
> > > >
> > > > Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
> > > > Cc: jingjing.wu@intel.com
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > ---
> > > >  drivers/net/iavf/iavf_rxtx.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > >
> > > > diff --git a/drivers/net/iavf/iavf_rxtx.c
> > > > b/drivers/net/iavf/iavf_rxtx.c index
> > > > f7df4665d1..797cdda4b2 100644
> > > > --- a/drivers/net/iavf/iavf_rxtx.c
> > > > +++ b/drivers/net/iavf/iavf_rxtx.c
> > > > @@ -755,6 +755,13 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev
> > > > *dev, uint16_t queue_idx,
> > > >  	if (check_rx_vec_allow(rxq) == false)
> > > >  		ad->rx_vec_allowed = false;
> > > >
> > > > +#if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM
> > > > +	/* check vector conflict */
> > > > +	if (ad->rx_vec_allowed && iavf_rxq_vec_setup(rxq)) {
> > > > +		PMD_DRV_LOG(ERR, "Failed vector rx setup.");
> > > > +		return -EINVAL;
> > > > +	}
> > > > +#endif
> > >
> > > Bruce:
> > >
> > > 	May I know more details about how to reproduce this issue?
> > > 	As the iavf PMD does not support
> > > RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP (i40e does)
> >
> > OK, not sure if the patch 4/4 answered my question ๐Ÿ˜Š
> >
> > should I squash patch 3, 4 into one? , for my understanding patch 3 doesn't
> appear to be a bug fix unless we announce
> RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP.
> >
> You may have a point. I was experimenting with queue reconfiguration which
> is where I hit this issue.
> However, even without queue reconfig support, the device still needs to
> support queue-stop followed by queue-start, I think, and there may still be an
> issue there - I'll have to check.

Yes, queue start / stop should be supported.
Btw, I didn't see mbuf_initializer has been reset during queue stop / start, it might be a different issue.




> /Bruce
  

Patch

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index f7df4665d1..797cdda4b2 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -755,6 +755,13 @@  iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_vec_allow(rxq) == false)
 		ad->rx_vec_allowed = false;
 
+#if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM
+	/* check vector conflict */
+	if (ad->rx_vec_allowed && iavf_rxq_vec_setup(rxq)) {
+		PMD_DRV_LOG(ERR, "Failed vector rx setup.");
+		return -EINVAL;
+	}
+#endif
 	return 0;
 }