[v1] net/i40e: support request any number of queues

Message ID 20190115145717.84697-1-zhirun.yan@intel.com
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series
  • [v1] net/i40e: support request any number of queues
Related show

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Yan, Zhirun Jan. 15, 2019, 2:57 p.m.
Before this patch, VF must request a specific queues(1/2/4/8/16) with
DPDK PF. This patch align the number of requested queues to next power
of 2. So VF can request any number queues from 1 to 16.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Zhang, Qi Z Jan. 15, 2019, 11:05 a.m. | #1
> -----Original Message-----
> From: Yan, Zhirun
> Sent: Tuesday, January 15, 2019 10:57 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: Yan, Zhirun <zhirun.yan@intel.com>
> Subject: [PATCH v1] net/i40e: support request any number of queues
> 
> Before this patch, VF must request a specific queues(1/2/4/8/16) with DPDK PF.
> This patch align the number of requested queues to next power of 2. So VF can
> request any number queues from 1 to 16.
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi
Kevin Traynor Jan. 15, 2019, 5:33 p.m. | #2
On 01/15/2019 02:57 PM, Zhirun Yan wrote:
> Before this patch, VF must request a specific queues(1/2/4/8/16) with
> DPDK PF. This patch align the number of requested queues to next power
> of 2. So VF can request any number queues from 1 to 16.
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
>  drivers/net/i40e/i40e_pf.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
> index 092e0d3e9..d110dffb7 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -1271,7 +1271,10 @@ i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg)
>  	} else {
>  		i40e_vc_notify_vf_reset(vf);
>  		vf->vsi->nb_qps = req_pairs;
> -		pf->vf_nb_qps = req_pairs;
> +		if (rte_is_power_of_2(req_pairs))
> +			pf->vf_nb_qps = req_pairs;
> +		else
> +			pf->vf_nb_qps = i40e_align_floor(req_pairs) << 1;

Shouldn't you do this before you validate against the number of free
queue pairs? or it is somehow handled

>  		i40e_pf_host_process_cmd_reset_vf(vf);
>  
>  		return 0;
>
Yan, Zhirun Jan. 17, 2019, 7:26 a.m. | #3
> -----Original Message-----
> From: Kevin Traynor [mailto:ktraynor@redhat.com]
> Sent: Wednesday, January 16, 2019 1:34 AM
> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net/i40e: support request any number of
> queues
> 
> On 01/15/2019 02:57 PM, Zhirun Yan wrote:
> > Before this patch, VF must request a specific queues(1/2/4/8/16) with
> > DPDK PF. This patch align the number of requested queues to next power
> > of 2. So VF can request any number queues from 1 to 16.
> >
> > Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> > ---
> >  drivers/net/i40e/i40e_pf.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
> > index 092e0d3e9..d110dffb7 100644
> > --- a/drivers/net/i40e/i40e_pf.c
> > +++ b/drivers/net/i40e/i40e_pf.c
> > @@ -1271,7 +1271,10 @@
> i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t
> *msg)
> >  	} else {
> >  		i40e_vc_notify_vf_reset(vf);
> >  		vf->vsi->nb_qps = req_pairs;
> > -		pf->vf_nb_qps = req_pairs;
> > +		if (rte_is_power_of_2(req_pairs))
> > +			pf->vf_nb_qps = req_pairs;
> > +		else
> > +			pf->vf_nb_qps = i40e_align_floor(req_pairs) << 1;
> 
> Shouldn't you do this before you validate against the number of free queue
> pairs? or it is somehow handled

Before PF alloc queue to VF, PF will check the queue number in i40e_res_pool_alloc().
Suppose there are 15 queues left in PF, this part will check 12 as a valid value if request 12 queues,
 But PF  will refuse to alloc 16 queue.

> 
> >  		i40e_pf_host_process_cmd_reset_vf(vf);
> >
> >  		return 0;
> >
Kevin Traynor March 5, 2019, 4:19 p.m. | #4
On 17/01/2019 07:26, Yan, Zhirun wrote:
> 
> 
>> -----Original Message-----
>> From: Kevin Traynor [mailto:ktraynor@redhat.com]
>> Sent: Wednesday, January 16, 2019 1:34 AM
>> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
>> <qi.z.zhang@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v1] net/i40e: support request any number of
>> queues
>>
>> On 01/15/2019 02:57 PM, Zhirun Yan wrote:
>>> Before this patch, VF must request a specific queues(1/2/4/8/16) with
>>> DPDK PF. This patch align the number of requested queues to next power
>>> of 2. So VF can request any number queues from 1 to 16.
>>>
>>> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
>>> ---
>>>  drivers/net/i40e/i40e_pf.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
>>> index 092e0d3e9..d110dffb7 100644
>>> --- a/drivers/net/i40e/i40e_pf.c
>>> +++ b/drivers/net/i40e/i40e_pf.c
>>> @@ -1271,7 +1271,10 @@
>> i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t
>> *msg)
>>>  	} else {
>>>  		i40e_vc_notify_vf_reset(vf);
>>>  		vf->vsi->nb_qps = req_pairs;
>>> -		pf->vf_nb_qps = req_pairs;
>>> +		if (rte_is_power_of_2(req_pairs))
>>> +			pf->vf_nb_qps = req_pairs;
>>> +		else
>>> +			pf->vf_nb_qps = i40e_align_floor(req_pairs) << 1;
>>
>> Shouldn't you do this before you validate against the number of free queue
>> pairs? or it is somehow handled
> 
> Before PF alloc queue to VF, PF will check the queue number in i40e_res_pool_alloc().
> Suppose there are 15 queues left in PF, this part will check 12 as a valid value if request 12 queues,
>  But PF  will refuse to alloc 16 queue.
> 

Hello. In that scenario the vsi is reset and there is a failed setup,
whereas it could be caught here and max rounded value sent back to vf. I
will send a patch to show what I mean (compile tested only). Please take
a look.

>>
>>>  		i40e_pf_host_process_cmd_reset_vf(vf);
>>>
>>>  		return 0;
>>>
>

Patch

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 092e0d3e9..d110dffb7 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1271,7 +1271,10 @@  i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg)
 	} else {
 		i40e_vc_notify_vf_reset(vf);
 		vf->vsi->nb_qps = req_pairs;
-		pf->vf_nb_qps = req_pairs;
+		if (rte_is_power_of_2(req_pairs))
+			pf->vf_nb_qps = req_pairs;
+		else
+			pf->vf_nb_qps = i40e_align_floor(req_pairs) << 1;
 		i40e_pf_host_process_cmd_reset_vf(vf);
 
 		return 0;