DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] net/ice: optimize max queue number calculation
@ 2022-04-08 11:23 Qi Zhang
  2022-04-26 13:14 ` Wu, Wenjun1
  0 siblings, 1 reply; 3+ messages in thread
From: Qi Zhang @ 2022-04-08 11:23 UTC (permalink / raw)
  To: qiming.yang, wenjun1.wu; +Cc: dev, Qi Zhang

Remove the limitation that max queue pair number must be 2^n.
With this patch, even on a 8 ports device, the max queue pair
number increased from 128 to 254.

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

v2:
- fix check patch warning

 drivers/net/ice/ice_ethdev.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 73e550f5fb..ff2b3e45d9 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -819,10 +819,26 @@ ice_vsi_config_tc_queue_mapping(struct ice_vsi *vsi,
 		return -ENOTSUP;
 	}
 
-	vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC);
-	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps) - 1;
-	/* Adjust the queue number to actual queues that can be applied */
-	vsi->nb_qps = (vsi->nb_qps == 0) ? 0 : 0x1 << fls;
+	/* vector 0 is reserved and 1 vector for ctrl vsi */
+	if (vsi->adapter->hw.func_caps.common_cap.num_msix_vectors < 2)
+		vsi->nb_qps = 0;
+	else
+		vsi->nb_qps = RTE_MIN
+			((uint16_t)vsi->adapter->hw.func_caps.common_cap.num_msix_vectors - 2,
+			RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC));
+
+	/* nb_qps(hex)  -> fls */
+	/* 0000		-> 0 */
+	/* 0001		-> 0 */
+	/* 0002		-> 1 */
+	/* 0003 ~ 0004	-> 2 */
+	/* 0005 ~ 0008	-> 3 */
+	/* 0009 ~ 0010	-> 4 */
+	/* 0011 ~ 0020	-> 5 */
+	/* 0021 ~ 0040	-> 6 */
+	/* 0041 ~ 0080	-> 7 */
+	/* 0081 ~ 0100	-> 8 */
+	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps - 1);
 
 	qp_idx = 0;
 	/* Set tc and queue mapping with VSI */
-- 
2.26.2


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

* RE: [PATCH v2] net/ice: optimize max queue number calculation
  2022-04-08 11:23 [PATCH v2] net/ice: optimize max queue number calculation Qi Zhang
@ 2022-04-26 13:14 ` Wu, Wenjun1
  2022-04-27  0:06   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Wu, Wenjun1 @ 2022-04-26 13:14 UTC (permalink / raw)
  To: Zhang, Qi Z, Yang, Qiming; +Cc: dev



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, April 8, 2022 7:24 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Wu, Wenjun1
> <wenjun1.wu@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH v2] net/ice: optimize max queue number calculation
> 
> Remove the limitation that max queue pair number must be 2^n.
> With this patch, even on a 8 ports device, the max queue pair number
> increased from 128 to 254.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> 
> v2:
> - fix check patch warning
> 
>  drivers/net/ice/ice_ethdev.c | 24 ++++++++++++++++++++----
>  1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> 73e550f5fb..ff2b3e45d9 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -819,10 +819,26 @@ ice_vsi_config_tc_queue_mapping(struct ice_vsi
> *vsi,
>  		return -ENOTSUP;
>  	}
> 
> -	vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC);
> -	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps) - 1;
> -	/* Adjust the queue number to actual queues that can be applied */
> -	vsi->nb_qps = (vsi->nb_qps == 0) ? 0 : 0x1 << fls;
> +	/* vector 0 is reserved and 1 vector for ctrl vsi */
> +	if (vsi->adapter->hw.func_caps.common_cap.num_msix_vectors < 2)
> +		vsi->nb_qps = 0;
> +	else
> +		vsi->nb_qps = RTE_MIN
> +			((uint16_t)vsi->adapter-
> >hw.func_caps.common_cap.num_msix_vectors - 2,
> +			RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC));
> +
> +	/* nb_qps(hex)  -> fls */
> +	/* 0000		-> 0 */
> +	/* 0001		-> 0 */
> +	/* 0002		-> 1 */
> +	/* 0003 ~ 0004	-> 2 */
> +	/* 0005 ~ 0008	-> 3 */
> +	/* 0009 ~ 0010	-> 4 */
> +	/* 0011 ~ 0020	-> 5 */
> +	/* 0021 ~ 0040	-> 6 */
> +	/* 0041 ~ 0080	-> 7 */
> +	/* 0081 ~ 0100	-> 8 */
> +	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps - 1);
> 
>  	qp_idx = 0;
>  	/* Set tc and queue mapping with VSI */
> --
> 2.26.2

Acked-by: Wenjun Wu < wenjun1.wu@intel.com>

Thanks
Wenjun


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

* RE: [PATCH v2] net/ice: optimize max queue number calculation
  2022-04-26 13:14 ` Wu, Wenjun1
@ 2022-04-27  0:06   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-04-27  0:06 UTC (permalink / raw)
  To: Wu, Wenjun1, Yang, Qiming; +Cc: dev



> -----Original Message-----
> From: Wu, Wenjun1 <wenjun1.wu@intel.com>
> Sent: Tuesday, April 26, 2022 9:14 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2] net/ice: optimize max queue number calculation
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Friday, April 8, 2022 7:24 PM
> > To: Yang, Qiming <qiming.yang@intel.com>; Wu, Wenjun1
> > <wenjun1.wu@intel.com>
> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH v2] net/ice: optimize max queue number calculation
> >
> > Remove the limitation that max queue pair number must be 2^n.
> > With this patch, even on a 8 ports device, the max queue pair number
> > increased from 128 to 254.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >
> > v2:
> > - fix check patch warning
> >
> >  drivers/net/ice/ice_ethdev.c | 24 ++++++++++++++++++++----
> >  1 file changed, 20 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_ethdev.c
> > b/drivers/net/ice/ice_ethdev.c index
> > 73e550f5fb..ff2b3e45d9 100644
> > --- a/drivers/net/ice/ice_ethdev.c
> > +++ b/drivers/net/ice/ice_ethdev.c
> > @@ -819,10 +819,26 @@ ice_vsi_config_tc_queue_mapping(struct ice_vsi
> > *vsi,
> >  		return -ENOTSUP;
> >  	}
> >
> > -	vsi->nb_qps = RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC);
> > -	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps) - 1;
> > -	/* Adjust the queue number to actual queues that can be applied */
> > -	vsi->nb_qps = (vsi->nb_qps == 0) ? 0 : 0x1 << fls;
> > +	/* vector 0 is reserved and 1 vector for ctrl vsi */
> > +	if (vsi->adapter->hw.func_caps.common_cap.num_msix_vectors < 2)
> > +		vsi->nb_qps = 0;
> > +	else
> > +		vsi->nb_qps = RTE_MIN
> > +			((uint16_t)vsi->adapter-
> > >hw.func_caps.common_cap.num_msix_vectors - 2,
> > +			RTE_MIN(vsi->nb_qps, ICE_MAX_Q_PER_TC));
> > +
> > +	/* nb_qps(hex)  -> fls */
> > +	/* 0000		-> 0 */
> > +	/* 0001		-> 0 */
> > +	/* 0002		-> 1 */
> > +	/* 0003 ~ 0004	-> 2 */
> > +	/* 0005 ~ 0008	-> 3 */
> > +	/* 0009 ~ 0010	-> 4 */
> > +	/* 0011 ~ 0020	-> 5 */
> > +	/* 0021 ~ 0040	-> 6 */
> > +	/* 0041 ~ 0080	-> 7 */
> > +	/* 0081 ~ 0100	-> 8 */
> > +	fls = (vsi->nb_qps == 0) ? 0 : rte_fls_u32(vsi->nb_qps - 1);
> >
> >  	qp_idx = 0;
> >  	/* Set tc and queue mapping with VSI */
> > --
> > 2.26.2
> 
> Acked-by: Wenjun Wu < wenjun1.wu@intel.com>
> 
> Thanks
> Wenjun
> 

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2022-04-27  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 11:23 [PATCH v2] net/ice: optimize max queue number calculation Qi Zhang
2022-04-26 13:14 ` Wu, Wenjun1
2022-04-27  0:06   ` Zhang, Qi Z

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