[v7,4/5] power: modify return of queue_stopped

Message ID 20211018141638.5916-5-miao.li@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series Implement rte_power_monitor API in virtio/vhost PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Li, Miao Oct. 18, 2021, 2:16 p.m. UTC
  Since some vdevs like virtio and vhost do not support rxq_info_get and
queue state inquiry, the error return value -ENOTSUP need to be ignored
when queue_stopped cannot get rx queue information and rx queue state.
This patch changes the return value of queue_stopped when
rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which cannot
provide rx queue information and rx queue state enable power management.

Signed-off-by: Miao Li <miao.li@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Oct. 21, 2021, 4:48 p.m. UTC | #1
On 10/18/2021 3:16 PM, Miao Li wrote:
> Since some vdevs like virtio and vhost do not support rxq_info_get and
> queue state inquiry, the error return value -ENOTSUP need to be ignored
> when queue_stopped cannot get rx queue information and rx queue state.
> This patch changes the return value of queue_stopped when
> rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which cannot
> provide rx queue information and rx queue state enable power management.
> 

Don't we want to backport this patch? In case later a patch in the main
repo relies on this return type and that needs to be merged to LTS...

Also need to clarify if this is a fix or not.

> Signed-off-by: Miao Li <miao.li@intel.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

power library maintainer ack/review is missing.

> ---
>   lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
> index 0ce40f0875..39a2b4cd23 100644
> --- a/lib/power/rte_power_pmd_mgmt.c
> +++ b/lib/power/rte_power_pmd_mgmt.c
> @@ -382,8 +382,13 @@ queue_stopped(const uint16_t port_id, const uint16_t queue_id)
>   {
>   	struct rte_eth_rxq_info qinfo;
>   
> -	if (rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo) < 0)
> -		return -1;
> +	int ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
> +	if (ret < 0) {
> +		if (ret == -ENOTSUP)
> +			return 1;
> +		else
> +			return -1;
> +	}
>   
>   	return qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED;
>   }
>
  
Li, Miao Oct. 22, 2021, 8:20 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Friday, October 22, 2021 12:48 AM
> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org; Hunt, David
> <david.hunt@intel.com>
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v7 4/5] power: modify return of queue_stopped
> 
> On 10/18/2021 3:16 PM, Miao Li wrote:
> > Since some vdevs like virtio and vhost do not support rxq_info_get and
> > queue state inquiry, the error return value -ENOTSUP need to be ignored
> > when queue_stopped cannot get rx queue information and rx queue state.
> > This patch changes the return value of queue_stopped when
> > rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which cannot
> > provide rx queue information and rx queue state enable power management.
> >
> 
> Don't we want to backport this patch? In case later a patch in the main
> repo relies on this return type and that needs to be merged to LTS...
> 
> Also need to clarify if this is a fix or not.

Yes, it is a fix. I will backport this patch to LTS in the next version.

Thanks,
Miao

> 
> > Signed-off-by: Miao Li <miao.li@intel.com>
> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 
> power library maintainer ack/review is missing.
> 
> > ---
> >   lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
> >   1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/power/rte_power_pmd_mgmt.c
> b/lib/power/rte_power_pmd_mgmt.c
> > index 0ce40f0875..39a2b4cd23 100644
> > --- a/lib/power/rte_power_pmd_mgmt.c
> > +++ b/lib/power/rte_power_pmd_mgmt.c
> > @@ -382,8 +382,13 @@ queue_stopped(const uint16_t port_id, const
> uint16_t queue_id)
> >   {
> >   	struct rte_eth_rxq_info qinfo;
> >
> > -	if (rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo) < 0)
> > -		return -1;
> > +	int ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
> > +	if (ret < 0) {
> > +		if (ret == -ENOTSUP)
> > +			return 1;
> > +		else
> > +			return -1;
> > +	}
> >
> >   	return qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED;
> >   }
> >
  
Ferruh Yigit Oct. 22, 2021, 9:01 a.m. UTC | #3
On 10/22/2021 9:20 AM, Li, Miao wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Sent: Friday, October 22, 2021 12:48 AM
>> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org; Hunt, David
>> <david.hunt@intel.com>
>> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
>> Burakov, Anatoly <anatoly.burakov@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v7 4/5] power: modify return of queue_stopped
>>
>> On 10/18/2021 3:16 PM, Miao Li wrote:
>>> Since some vdevs like virtio and vhost do not support rxq_info_get and
>>> queue state inquiry, the error return value -ENOTSUP need to be ignored
>>> when queue_stopped cannot get rx queue information and rx queue state.
>>> This patch changes the return value of queue_stopped when
>>> rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which cannot
>>> provide rx queue information and rx queue state enable power management.
>>>
>>
>> Don't we want to backport this patch? In case later a patch in the main
>> repo relies on this return type and that needs to be merged to LTS...
>>
>> Also need to clarify if this is a fix or not.
> 
> Yes, it is a fix. I will backport this patch to LTS in the next version.
> 

If so can you please update the Fixes and stable tags?

This way it will be part of backporting process.

> Thanks,
> Miao
> 
>>
>>> Signed-off-by: Miao Li <miao.li@intel.com>
>>> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
>>
>> power library maintainer ack/review is missing.
>>
>>> ---
>>>    lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
>>>    1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/lib/power/rte_power_pmd_mgmt.c
>> b/lib/power/rte_power_pmd_mgmt.c
>>> index 0ce40f0875..39a2b4cd23 100644
>>> --- a/lib/power/rte_power_pmd_mgmt.c
>>> +++ b/lib/power/rte_power_pmd_mgmt.c
>>> @@ -382,8 +382,13 @@ queue_stopped(const uint16_t port_id, const
>> uint16_t queue_id)
>>>    {
>>>    	struct rte_eth_rxq_info qinfo;
>>>
>>> -	if (rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo) < 0)
>>> -		return -1;
>>> +	int ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
>>> +	if (ret < 0) {
>>> +		if (ret == -ENOTSUP)
>>> +			return 1;
>>> +		else
>>> +			return -1;
>>> +	}
>>>
>>>    	return qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED;
>>>    }
>>>
>
  
Li, Miao Oct. 22, 2021, 9:05 a.m. UTC | #4
Hi,

> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Friday, October 22, 2021 5:01 PM
> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org; Hunt, David
> <david.hunt@intel.com>
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> Burakov, Anatoly <anatoly.burakov@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v7 4/5] power: modify return of queue_stopped
> 
> On 10/22/2021 9:20 AM, Li, Miao wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >> Sent: Friday, October 22, 2021 12:48 AM
> >> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org; Hunt, David
> >> <david.hunt@intel.com>
> >> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> >> Burakov, Anatoly <anatoly.burakov@intel.com>
> >> Subject: Re: [dpdk-dev] [PATCH v7 4/5] power: modify return of
> queue_stopped
> >>
> >> On 10/18/2021 3:16 PM, Miao Li wrote:
> >>> Since some vdevs like virtio and vhost do not support rxq_info_get and
> >>> queue state inquiry, the error return value -ENOTSUP need to be ignored
> >>> when queue_stopped cannot get rx queue information and rx queue state.
> >>> This patch changes the return value of queue_stopped when
> >>> rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which
> cannot
> >>> provide rx queue information and rx queue state enable power management.
> >>>
> >>
> >> Don't we want to backport this patch? In case later a patch in the main
> >> repo relies on this return type and that needs to be merged to LTS...
> >>
> >> Also need to clarify if this is a fix or not.
> >
> > Yes, it is a fix. I will backport this patch to LTS in the next version.
> >
> 
> If so can you please update the Fixes and stable tags?
> 
> This way it will be part of backporting process.

I will update them in the next version.

Thanks,
Miao

> 
> > Thanks,
> > Miao
> >
> >>
> >>> Signed-off-by: Miao Li <miao.li@intel.com>
> >>> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >>> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> >>
> >> power library maintainer ack/review is missing.
> >>
> >>> ---
> >>>    lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
> >>>    1 file changed, 7 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/lib/power/rte_power_pmd_mgmt.c
> >> b/lib/power/rte_power_pmd_mgmt.c
> >>> index 0ce40f0875..39a2b4cd23 100644
> >>> --- a/lib/power/rte_power_pmd_mgmt.c
> >>> +++ b/lib/power/rte_power_pmd_mgmt.c
> >>> @@ -382,8 +382,13 @@ queue_stopped(const uint16_t port_id, const
> >> uint16_t queue_id)
> >>>    {
> >>>    	struct rte_eth_rxq_info qinfo;
> >>>
> >>> -	if (rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo) < 0)
> >>> -		return -1;
> >>> +	int ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
> >>> +	if (ret < 0) {
> >>> +		if (ret == -ENOTSUP)
> >>> +			return 1;
> >>> +		else
> >>> +			return -1;
> >>> +	}
> >>>
> >>>    	return qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED;
> >>>    }
> >>>
> >
  
Hunt, David Oct. 22, 2021, 11:54 a.m. UTC | #5
On 21/10/2021 5:48 PM, Ferruh Yigit wrote:
> On 10/18/2021 3:16 PM, Miao Li wrote:
>> Since some vdevs like virtio and vhost do not support rxq_info_get and
>> queue state inquiry, the error return value -ENOTSUP need to be ignored
>> when queue_stopped cannot get rx queue information and rx queue state.
>> This patch changes the return value of queue_stopped when
>> rte_eth_rx_queue_info_get return -ENOTSUP to support vdevs which cannot
>> provide rx queue information and rx queue state enable power management.
>>
>
> Don't we want to backport this patch? In case later a patch in the main
> repo relies on this return type and that needs to be merged to LTS...
>
> Also need to clarify if this is a fix or not.
>
>> Signed-off-by: Miao Li <miao.li@intel.com>
>> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
>
> power library maintainer ack/review is missing.


Hi Ferruh,
   Anatoly's Ack is good on this, he's very familiar with this code.
Rgds,
Dave.



--snip--
  

Patch

diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 0ce40f0875..39a2b4cd23 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -382,8 +382,13 @@  queue_stopped(const uint16_t port_id, const uint16_t queue_id)
 {
 	struct rte_eth_rxq_info qinfo;
 
-	if (rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo) < 0)
-		return -1;
+	int ret = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
+	if (ret < 0) {
+		if (ret == -ENOTSUP)
+			return 1;
+		else
+			return -1;
+	}
 
 	return qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED;
 }