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

Message ID 20210924102309.231304-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 Sept. 24, 2021, 10:23 a.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>
---
 lib/power/rte_power_pmd_mgmt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Chenbo Xia Sept. 29, 2021, 3:03 a.m. UTC | #1
> -----Original Message-----
> From: Li, Miao <miao.li@intel.com>
> Sent: Friday, September 24, 2021 6:23 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li, Miao
> <miao.li@intel.com>
> Subject: [PATCH v3 4/5] power: modify return of queue_stopped
> 
> 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>
> ---
>  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;
>  }
> --
> 2.25.1

Anatoly's ACK is missed.
  
Li, Miao Oct. 11, 2021, 5:18 a.m. UTC | #2
Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Wednesday, September 29, 2021 11:03 AM
> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com
> Subject: RE: [PATCH v3 4/5] power: modify return of queue_stopped
> 
> > -----Original Message-----
> > From: Li, Miao <miao.li@intel.com>
> > Sent: Friday, September 24, 2021 6:23 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li,
> Miao
> > <miao.li@intel.com>
> > Subject: [PATCH v3 4/5] power: modify return of queue_stopped
> >
> > 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>
> > ---
> >  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;
> >  }
> > --
> > 2.25.1
> 
> Anatoly's ACK is missed.

I will add it in the next version.

Thanks,
Miao
  

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;
 }