net/iavf: fix queue pairs configuration

Message ID 20201223052936.7200-1-alvinx.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/iavf: fix queue pairs configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Alvin Zhang Dec. 23, 2020, 5:29 a.m. UTC
  From: Alvin Zhang <alvinx.zhang@intel.com>

Check if there are enough queue pairs currently allocated, and if not,
request PF to allocate them.

Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Xu, Ting Dec. 23, 2020, 6:06 a.m. UTC | #1
Hi, Alvin,

> -----Original Message-----
> From: Zhang,Alvin <alvinx.zhang@intel.com>
> Sent: Wednesday, December 23, 2020 1:30 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Xu, Ting <ting.xu@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/iavf: fix queue pairs configuration
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> Check if there are enough queue pairs currently allocated, and if not, request
> PF to allocate them.
> 
> Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 7e3c26a..f015121 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -372,8 +372,10 @@ struct rte_iavf_xstats_name_off {
>  	} else {
>  		/* Check if large VF is already enabled. If so, disable and
>  		 * release redundant queue resource.
> +		 * Or check if enough queue pairs. If not, request them from
> PF.
>  		 */
> -		if (vf->lv_enabled) {
> +		if (vf->lv_enabled ||
> +		    num_queue_pairs > vf->vsi_res->num_queue_pairs) {
>  			ret = iavf_queues_req_reset(dev, num_queue_pairs);
>  			if (ret)
>  				return ret;
> --
> 1.8.3.1

Will it be better to change ret = iavf_queues_req_reset(dev, num_queue_pairs); to ret = iavf_queues_req_reset(dev, IAVF_MAX_NUM_QUEUES_DFLT); based on the original codes?
Since PF provides default 16 queue pairs to VF. If large VF is no need to be enabled, it may be better to reset the queue pairs number to 16. So that we don't need to compare the queue pairs number and request queues each time when it is no more than 16. If more, it turns to large VF to handle.
The original codes here are not good.
Thanks.
  
Alvin Zhang Dec. 23, 2020, 6:28 a.m. UTC | #2
Hi Xuting,

Thanks for your reply.
It's very efficient for CVL. But the FVL PF provides default 4 queue pairs to VF,
if every VF request 16 queue pairs, there may be not enough queues pairs for all VFs.

BR,
Alvin

> -----Original Message-----
> From: Xu, Ting <ting.xu@intel.com>
> Sent: Wednesday, December 23, 2020 2:06 PM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] net/iavf: fix queue pairs configuration
> 
> Hi, Alvin,
> 
> > -----Original Message-----
> > From: Zhang,Alvin <alvinx.zhang@intel.com>
> > Sent: Wednesday, December 23, 2020 1:30 PM
> > To: Xing, Beilei <beilei.xing@intel.com>; Xu, Ting <ting.xu@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] net/iavf: fix queue pairs configuration
> >
> > From: Alvin Zhang <alvinx.zhang@intel.com>
> >
> > Check if there are enough queue pairs currently allocated, and if not,
> > request PF to allocate them.
> >
> > Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more
> > queues")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > ---
> >  drivers/net/iavf/iavf_ethdev.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/iavf/iavf_ethdev.c
> > b/drivers/net/iavf/iavf_ethdev.c index 7e3c26a..f015121 100644
> > --- a/drivers/net/iavf/iavf_ethdev.c
> > +++ b/drivers/net/iavf/iavf_ethdev.c
> > @@ -372,8 +372,10 @@ struct rte_iavf_xstats_name_off {
> >  	} else {
> >  		/* Check if large VF is already enabled. If so, disable and
> >  		 * release redundant queue resource.
> > +		 * Or check if enough queue pairs. If not, request them from
> > PF.
> >  		 */
> > -		if (vf->lv_enabled) {
> > +		if (vf->lv_enabled ||
> > +		    num_queue_pairs > vf->vsi_res->num_queue_pairs) {
> >  			ret = iavf_queues_req_reset(dev, num_queue_pairs);
> >  			if (ret)
> >  				return ret;
> > --
> > 1.8.3.1
> 
> Will it be better to change ret = iavf_queues_req_reset(dev, num_queue_pairs);
> to ret = iavf_queues_req_reset(dev, IAVF_MAX_NUM_QUEUES_DFLT); based on
> the original codes?
> Since PF provides default 16 queue pairs to VF. If large VF is no need to be
> enabled, it may be better to reset the queue pairs number to 16. So that we
> don't need to compare the queue pairs number and request queues each time
> when it is no more than 16. If more, it turns to large VF to handle.
> The original codes here are not good.
> Thanks.
  
Huang, ZhiminX Dec. 24, 2020, 9:33 a.m. UTC | #3
Tested-by: Huang, ZhiminX <zhiminx.huang@intel.com>

Regards,
HuangZhiMin


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Zhang,Alvin
> Sent: Wednesday, December 23, 2020 1:30 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Xu, Ting <ting.xu@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix queue pairs configuration
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> Check if there are enough queue pairs currently allocated, and if not, request
> PF to allocate them.
> 
> Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index
> 7e3c26a..f015121 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -372,8 +372,10 @@ struct rte_iavf_xstats_name_off {
>  	} else {
>  		/* Check if large VF is already enabled. If so, disable and
>  		 * release redundant queue resource.
> +		 * Or check if enough queue pairs. If not, request them from PF.
>  		 */
> -		if (vf->lv_enabled) {
> +		if (vf->lv_enabled ||
> +		    num_queue_pairs > vf->vsi_res->num_queue_pairs) {
>  			ret = iavf_queues_req_reset(dev, num_queue_pairs);
>  			if (ret)
>  				return ret;
> --
> 1.8.3.1
  
Qi Zhang Dec. 28, 2020, 10:56 a.m. UTC | #4
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Zhang,Alvin
> Sent: Wednesday, December 23, 2020 1:30 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Xu, Ting <ting.xu@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/iavf: fix queue pairs configuration
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> Check if there are enough queue pairs currently allocated, and if not, request PF
> to allocate them.
> 
> Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7e3c26a..f015121 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -372,8 +372,10 @@  struct rte_iavf_xstats_name_off {
 	} else {
 		/* Check if large VF is already enabled. If so, disable and
 		 * release redundant queue resource.
+		 * Or check if enough queue pairs. If not, request them from PF.
 		 */
-		if (vf->lv_enabled) {
+		if (vf->lv_enabled ||
+		    num_queue_pairs > vf->vsi_res->num_queue_pairs) {
 			ret = iavf_queues_req_reset(dev, num_queue_pairs);
 			if (ret)
 				return ret;