diff mbox series

[V5] ethdev: add queue state when retrieve queue information

Message ID 1618628964-18913-1-git-send-email-oulijun@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series [V5] ethdev: add queue state when retrieve queue information | expand

Checks

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

Commit Message

Lijun Ou April 17, 2021, 3:09 a.m. UTC
Currently, upper-layer application could get queue state only
through pointers such as dev->data->tx_queue_state[queue_id],
this is not the recommended way to access it. So this patch
add get queue state when call rte_eth_rx_queue_info_get and
rte_eth_tx_queue_info_get API.

Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
it could be ABI compatible.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
V4->V5:
- Add acked-by
- add a note to the "New features" section to annouce the new feature.

V3->V4:
- update libabigail.abignore for removing the CI warnings

V2->V3:
- rewrite the commit log and delete the part Note
- rewrite tht comments for queue state
- move the queue_state definition locations

V1->V2:
- move queue state defines to public file
---
 doc/guides/rel_notes/release_21_05.rst | 6 ++++++
 lib/librte_ethdev/ethdev_driver.h      | 7 -------
 lib/librte_ethdev/rte_ethdev.c         | 3 +++
 lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
 4 files changed, 18 insertions(+), 7 deletions(-)

Comments

Ferruh Yigit April 17, 2021, 10 p.m. UTC | #1
On 4/17/2021 4:09 AM, Lijun Ou wrote:
> Currently, upper-layer application could get queue state only
> through pointers such as dev->data->tx_queue_state[queue_id],
> this is not the recommended way to access it. So this patch
> add get queue state when call rte_eth_rx_queue_info_get and
> rte_eth_tx_queue_info_get API.
> 
> Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
> remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
> it could be ABI compatible.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
> V4->V5:
> - Add acked-by
> - add a note to the "New features" section to annouce the new feature.
> 
> V3->V4:
> - update libabigail.abignore for removing the CI warnings
> 
> V2->V3:
> - rewrite the commit log and delete the part Note
> - rewrite tht comments for queue state
> - move the queue_state definition locations
> 
> V1->V2:
> - move queue state defines to public file
> ---
>   doc/guides/rel_notes/release_21_05.rst | 6 ++++++
>   lib/librte_ethdev/ethdev_driver.h      | 7 -------
>   lib/librte_ethdev/rte_ethdev.c         | 3 +++
>   lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
>   4 files changed, 18 insertions(+), 7 deletions(-)

missing 'libabigail.abignore' that was in v4?
Lijun Ou April 19, 2021, 1:39 a.m. UTC | #2
在 2021/4/18 6:00, Ferruh Yigit 写道:
> On 4/17/2021 4:09 AM, Lijun Ou wrote:
>> Currently, upper-layer application could get queue state only
>> through pointers such as dev->data->tx_queue_state[queue_id],
>> this is not the recommended way to access it. So this patch
>> add get queue state when call rte_eth_rx_queue_info_get and
>> rte_eth_tx_queue_info_get API.
>>
>> Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
>> remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
>> it could be ABI compatible.
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
>> ---
>> V4->V5:
>> - Add acked-by
>> - add a note to the "New features" section to annouce the new feature.
>>
>> V3->V4:
>> - update libabigail.abignore for removing the CI warnings
>>
>> V2->V3:
>> - rewrite the commit log and delete the part Note
>> - rewrite tht comments for queue state
>> - move the queue_state definition locations
>>
>> V1->V2:
>> - move queue state defines to public file
>> ---
>>   doc/guides/rel_notes/release_21_05.rst | 6 ++++++
>>   lib/librte_ethdev/ethdev_driver.h      | 7 -------
>>   lib/librte_ethdev/rte_ethdev.c         | 3 +++
>>   lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
>>   4 files changed, 18 insertions(+), 7 deletions(-)
> 
> missing 'libabigail.abignore' that was in v4?
> .
Yes. the CI is warning after I send the V3 with fix some comments.
Then I update liabigail.bignore, taking into account your comments with 
thomas and send the V4.
>
Lijun Ou April 19, 2021, 2:04 a.m. UTC | #3
在 2021/4/18 6:00, Ferruh Yigit 写道:
> On 4/17/2021 4:09 AM, Lijun Ou wrote:
>> Currently, upper-layer application could get queue state only
>> through pointers such as dev->data->tx_queue_state[queue_id],
>> this is not the recommended way to access it. So this patch
>> add get queue state when call rte_eth_rx_queue_info_get and
>> rte_eth_tx_queue_info_get API.
>>
>> Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
>> remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
>> it could be ABI compatible.
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
>> ---
>> V4->V5:
>> - Add acked-by
>> - add a note to the "New features" section to annouce the new feature.
>>
>> V3->V4:
>> - update libabigail.abignore for removing the CI warnings
>>
>> V2->V3:
>> - rewrite the commit log and delete the part Note
>> - rewrite tht comments for queue state
>> - move the queue_state definition locations
>>
>> V1->V2:
>> - move queue state defines to public file
>> ---
>>   doc/guides/rel_notes/release_21_05.rst | 6 ++++++
>>   lib/librte_ethdev/ethdev_driver.h      | 7 -------
>>   lib/librte_ethdev/rte_ethdev.c         | 3 +++
>>   lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
>>   4 files changed, 18 insertions(+), 7 deletions(-)
> 
> missing 'libabigail.abignore' that was in v4?
> .
Sorry. thanks. I have sent the new version for V6.
>
Kinsella, Ray April 23, 2021, 11:17 a.m. UTC | #4
On 17/04/2021 04:09, Lijun Ou wrote:
> Currently, upper-layer application could get queue state only
> through pointers such as dev->data->tx_queue_state[queue_id],
> this is not the recommended way to access it. So this patch
> add get queue state when call rte_eth_rx_queue_info_get and
> rte_eth_tx_queue_info_get API.
> 
> Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
> remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
> it could be ABI compatible.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
> V4->V5:
> - Add acked-by
> - add a note to the "New features" section to annouce the new feature.
> 
> V3->V4:
> - update libabigail.abignore for removing the CI warnings
> 
> V2->V3:
> - rewrite the commit log and delete the part Note
> - rewrite tht comments for queue state
> - move the queue_state definition locations
> 
> V1->V2:
> - move queue state defines to public file
> ---
>  doc/guides/rel_notes/release_21_05.rst | 6 ++++++
>  lib/librte_ethdev/ethdev_driver.h      | 7 -------
>  lib/librte_ethdev/rte_ethdev.c         | 3 +++
>  lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
>  4 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
> index 58272e1..1ab3681 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -81,6 +81,12 @@ New Features
>        representor=[[c#]pf#]sf# sf[0,2-1023] /* 1023 SFs.                     */
>        representor=[c#]pf#      c2pf[0,1]    /* 2 PFs on controller 2.        */
>  
> +* **Enhanced function for getting rxq/txq info ABI.**
> +  * Added new field ``queue_state`` to ``rte_eth_rxq_info`` structure to
> +    provide indicated rxq queue state.
> +  * Added new field ``queue_state`` to ``rte_eth_txq_info`` structure to
> +    provide indicated txq queue state.
> +
>  * **Added support for meter PPS profile.**
>  
>    Currently meter algorithms only supports bytes per second(BPS).
> diff --git a/lib/librte_ethdev/ethdev_driver.h b/lib/librte_ethdev/ethdev_driver.h
> index 113129d..40e474a 100644
> --- a/lib/librte_ethdev/ethdev_driver.h
> +++ b/lib/librte_ethdev/ethdev_driver.h
> @@ -952,13 +952,6 @@ struct eth_dev_ops {
>  };
>  
>  /**
> - * RX/TX queue states
> - */
> -#define RTE_ETH_QUEUE_STATE_STOPPED 0
> -#define RTE_ETH_QUEUE_STATE_STARTED 1
> -#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
> -
> -/**
>   * @internal
>   * Check if the selected Rx queue is hairpin queue.
>   *
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index c73d263..d5adf4f 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -5038,6 +5038,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>  
>  	memset(qinfo, 0, sizeof(*qinfo));
>  	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> +	qinfo->queue_state = dev->data->rx_queue_state[queue_id];
> +
>  	return 0;
>  }
>  
> @@ -5078,6 +5080,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>  
>  	memset(qinfo, 0, sizeof(*qinfo));
>  	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> +	qinfo->queue_state = dev->data->tx_queue_state[queue_id];
>  
>  	return 0;
>  }
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index 3b773b6..a0d01d2 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -1588,6 +1588,13 @@ struct rte_eth_dev_info {
>  };
>  
>  /**
> + * RX/TX queue states
> + */
> +#define RTE_ETH_QUEUE_STATE_STOPPED 0
> +#define RTE_ETH_QUEUE_STATE_STARTED 1
> +#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
> +
> +/**
>   * Ethernet device RX queue information structure.
>   * Used to retrieve information about configured queue.
>   */
> @@ -1595,6 +1602,7 @@ struct rte_eth_rxq_info {
>  	struct rte_mempool *mp;     /**< mempool used by that queue. */
>  	struct rte_eth_rxconf conf; /**< queue config parameters. */
>  	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */

Are we sure this is a false positive? - it is being added mid-structure on the rx-side at least.
Shouldn't this be appended to the end - unless it is being sneaked into padding between fields. 

>  	uint16_t nb_desc;           /**< configured number of RXDs. */
>  	uint16_t rx_buf_size;       /**< hardware receive buffer size. */
>  } __rte_cache_min_aligned;
> @@ -1606,6 +1614,7 @@ struct rte_eth_rxq_info {
>  struct rte_eth_txq_info {
>  	struct rte_eth_txconf conf; /**< queue config parameters. */
>  	uint16_t nb_desc;           /**< configured number of TXDs. */
> +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
>  } __rte_cache_min_aligned;
>  
>  /* Generic Burst mode flag definition, values can be ORed. */
>
Ananyev, Konstantin April 23, 2021, 11:26 a.m. UTC | #5
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Kinsella, Ray
> Sent: Friday, April 23, 2021 12:17 PM
> To: Lijun Ou <oulijun@huawei.com>; thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; linuxarm@openeuler.org
> Subject: Re: [dpdk-dev] [PATCH V5] ethdev: add queue state when retrieve queue information
> 
> 
> 
> On 17/04/2021 04:09, Lijun Ou wrote:
> > Currently, upper-layer application could get queue state only
> > through pointers such as dev->data->tx_queue_state[queue_id],
> > this is not the recommended way to access it. So this patch
> > add get queue state when call rte_eth_rx_queue_info_get and
> > rte_eth_tx_queue_info_get API.
> >
> > Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
> > remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
> > it could be ABI compatible.
> >
> > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> > Signed-off-by: Lijun Ou <oulijun@huawei.com>
> > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > ---
> > V4->V5:
> > - Add acked-by
> > - add a note to the "New features" section to annouce the new feature.
> >
> > V3->V4:
> > - update libabigail.abignore for removing the CI warnings
> >
> > V2->V3:
> > - rewrite the commit log and delete the part Note
> > - rewrite tht comments for queue state
> > - move the queue_state definition locations
> >
> > V1->V2:
> > - move queue state defines to public file
> > ---
> >  doc/guides/rel_notes/release_21_05.rst | 6 ++++++
> >  lib/librte_ethdev/ethdev_driver.h      | 7 -------
> >  lib/librte_ethdev/rte_ethdev.c         | 3 +++
> >  lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
> >  4 files changed, 18 insertions(+), 7 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
> > index 58272e1..1ab3681 100644
> > --- a/doc/guides/rel_notes/release_21_05.rst
> > +++ b/doc/guides/rel_notes/release_21_05.rst
> > @@ -81,6 +81,12 @@ New Features
> >        representor=[[c#]pf#]sf# sf[0,2-1023] /* 1023 SFs.                     */
> >        representor=[c#]pf#      c2pf[0,1]    /* 2 PFs on controller 2.        */
> >
> > +* **Enhanced function for getting rxq/txq info ABI.**
> > +  * Added new field ``queue_state`` to ``rte_eth_rxq_info`` structure to
> > +    provide indicated rxq queue state.
> > +  * Added new field ``queue_state`` to ``rte_eth_txq_info`` structure to
> > +    provide indicated txq queue state.
> > +
> >  * **Added support for meter PPS profile.**
> >
> >    Currently meter algorithms only supports bytes per second(BPS).
> > diff --git a/lib/librte_ethdev/ethdev_driver.h b/lib/librte_ethdev/ethdev_driver.h
> > index 113129d..40e474a 100644
> > --- a/lib/librte_ethdev/ethdev_driver.h
> > +++ b/lib/librte_ethdev/ethdev_driver.h
> > @@ -952,13 +952,6 @@ struct eth_dev_ops {
> >  };
> >
> >  /**
> > - * RX/TX queue states
> > - */
> > -#define RTE_ETH_QUEUE_STATE_STOPPED 0
> > -#define RTE_ETH_QUEUE_STATE_STARTED 1
> > -#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
> > -
> > -/**
> >   * @internal
> >   * Check if the selected Rx queue is hairpin queue.
> >   *
> > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> > index c73d263..d5adf4f 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -5038,6 +5038,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> >
> >  	memset(qinfo, 0, sizeof(*qinfo));
> >  	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> > +	qinfo->queue_state = dev->data->rx_queue_state[queue_id];
> > +
> >  	return 0;
> >  }
> >
> > @@ -5078,6 +5080,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> >
> >  	memset(qinfo, 0, sizeof(*qinfo));
> >  	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> > +	qinfo->queue_state = dev->data->tx_queue_state[queue_id];
> >
> >  	return 0;
> >  }
> > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> > index 3b773b6..a0d01d2 100644
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> > @@ -1588,6 +1588,13 @@ struct rte_eth_dev_info {
> >  };
> >
> >  /**
> > + * RX/TX queue states
> > + */
> > +#define RTE_ETH_QUEUE_STATE_STOPPED 0
> > +#define RTE_ETH_QUEUE_STATE_STARTED 1
> > +#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
> > +
> > +/**
> >   * Ethernet device RX queue information structure.
> >   * Used to retrieve information about configured queue.
> >   */
> > @@ -1595,6 +1602,7 @@ struct rte_eth_rxq_info {
> >  	struct rte_mempool *mp;     /**< mempool used by that queue. */
> >  	struct rte_eth_rxconf conf; /**< queue config parameters. */
> >  	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
> 
> Are we sure this is a false positive? - it is being added mid-structure on the rx-side at least.
> Shouldn't this be appended to the end - unless it is being sneaked into padding between fields.

I believe there was a padding, that's why it was suggested to squeeze it here.

> 
> >  	uint16_t nb_desc;           /**< configured number of RXDs. */
> >  	uint16_t rx_buf_size;       /**< hardware receive buffer size. */
> >  } __rte_cache_min_aligned;
> > @@ -1606,6 +1614,7 @@ struct rte_eth_rxq_info {
> >  struct rte_eth_txq_info {
> >  	struct rte_eth_txconf conf; /**< queue config parameters. */
> >  	uint16_t nb_desc;           /**< configured number of TXDs. */
> > +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
> >  } __rte_cache_min_aligned;
> >
> >  /* Generic Burst mode flag definition, values can be ORed. */
> >
Kinsella, Ray April 23, 2021, 3:43 p.m. UTC | #6
On 23/04/2021 12:26, Ananyev, Konstantin wrote:
> 
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Kinsella, Ray
>> Sent: Friday, April 23, 2021 12:17 PM
>> To: Lijun Ou <oulijun@huawei.com>; thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Cc: dev@dpdk.org; linuxarm@openeuler.org
>> Subject: Re: [dpdk-dev] [PATCH V5] ethdev: add queue state when retrieve queue information
>>
>>
>>
>> On 17/04/2021 04:09, Lijun Ou wrote:
>>> Currently, upper-layer application could get queue state only
>>> through pointers such as dev->data->tx_queue_state[queue_id],
>>> this is not the recommended way to access it. So this patch
>>> add get queue state when call rte_eth_rx_queue_info_get and
>>> rte_eth_tx_queue_info_get API.
>>>
>>> Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
>>> remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
>>> it could be ABI compatible.
>>>
>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>>> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
>>> ---
>>> V4->V5:
>>> - Add acked-by
>>> - add a note to the "New features" section to annouce the new feature.
>>>
>>> V3->V4:
>>> - update libabigail.abignore for removing the CI warnings
>>>
>>> V2->V3:
>>> - rewrite the commit log and delete the part Note
>>> - rewrite tht comments for queue state
>>> - move the queue_state definition locations
>>>
>>> V1->V2:
>>> - move queue state defines to public file
>>> ---
>>>  doc/guides/rel_notes/release_21_05.rst | 6 ++++++
>>>  lib/librte_ethdev/ethdev_driver.h      | 7 -------
>>>  lib/librte_ethdev/rte_ethdev.c         | 3 +++
>>>  lib/librte_ethdev/rte_ethdev.h         | 9 +++++++++
>>>  4 files changed, 18 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
>>> index 58272e1..1ab3681 100644
>>> --- a/doc/guides/rel_notes/release_21_05.rst
>>> +++ b/doc/guides/rel_notes/release_21_05.rst
>>> @@ -81,6 +81,12 @@ New Features
>>>        representor=[[c#]pf#]sf# sf[0,2-1023] /* 1023 SFs.                     */
>>>        representor=[c#]pf#      c2pf[0,1]    /* 2 PFs on controller 2.        */
>>>
>>> +* **Enhanced function for getting rxq/txq info ABI.**
>>> +  * Added new field ``queue_state`` to ``rte_eth_rxq_info`` structure to
>>> +    provide indicated rxq queue state.
>>> +  * Added new field ``queue_state`` to ``rte_eth_txq_info`` structure to
>>> +    provide indicated txq queue state.
>>> +
>>>  * **Added support for meter PPS profile.**
>>>
>>>    Currently meter algorithms only supports bytes per second(BPS).
>>> diff --git a/lib/librte_ethdev/ethdev_driver.h b/lib/librte_ethdev/ethdev_driver.h
>>> index 113129d..40e474a 100644
>>> --- a/lib/librte_ethdev/ethdev_driver.h
>>> +++ b/lib/librte_ethdev/ethdev_driver.h
>>> @@ -952,13 +952,6 @@ struct eth_dev_ops {
>>>  };
>>>
>>>  /**
>>> - * RX/TX queue states
>>> - */
>>> -#define RTE_ETH_QUEUE_STATE_STOPPED 0
>>> -#define RTE_ETH_QUEUE_STATE_STARTED 1
>>> -#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
>>> -
>>> -/**
>>>   * @internal
>>>   * Check if the selected Rx queue is hairpin queue.
>>>   *
>>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>>> index c73d263..d5adf4f 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>> @@ -5038,6 +5038,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>>>
>>>  	memset(qinfo, 0, sizeof(*qinfo));
>>>  	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
>>> +	qinfo->queue_state = dev->data->rx_queue_state[queue_id];
>>> +
>>>  	return 0;
>>>  }
>>>
>>> @@ -5078,6 +5080,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>>>
>>>  	memset(qinfo, 0, sizeof(*qinfo));
>>>  	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
>>> +	qinfo->queue_state = dev->data->tx_queue_state[queue_id];
>>>
>>>  	return 0;
>>>  }
>>> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
>>> index 3b773b6..a0d01d2 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>> @@ -1588,6 +1588,13 @@ struct rte_eth_dev_info {
>>>  };
>>>
>>>  /**
>>> + * RX/TX queue states
>>> + */
>>> +#define RTE_ETH_QUEUE_STATE_STOPPED 0
>>> +#define RTE_ETH_QUEUE_STATE_STARTED 1
>>> +#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
>>> +
>>> +/**
>>>   * Ethernet device RX queue information structure.
>>>   * Used to retrieve information about configured queue.
>>>   */
>>> @@ -1595,6 +1602,7 @@ struct rte_eth_rxq_info {
>>>  	struct rte_mempool *mp;     /**< mempool used by that queue. */
>>>  	struct rte_eth_rxconf conf; /**< queue config parameters. */
>>>  	uint8_t scattered_rx;       /**< scattered packets RX supported. */
>>> +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
>>
>> Are we sure this is a false positive? - it is being added mid-structure on the rx-side at least.
>> Shouldn't this be appended to the end - unless it is being sneaked into padding between fields.
> 
> I believe there was a padding, that's why it was suggested to squeeze it here.

Yes - I took a look with pahole after reading back in the thread a bit,
where Thomas points out the 1byte padding hole in memory we could use.
Good work, as it avoids having to rework the structure at the next ABI version. 

>>
>>>  	uint16_t nb_desc;           /**< configured number of RXDs. */
>>>  	uint16_t rx_buf_size;       /**< hardware receive buffer size. */
>>>  } __rte_cache_min_aligned;
>>> @@ -1606,6 +1614,7 @@ struct rte_eth_rxq_info {
>>>  struct rte_eth_txq_info {
>>>  	struct rte_eth_txconf conf; /**< queue config parameters. */
>>>  	uint16_t nb_desc;           /**< configured number of TXDs. */
>>> +	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
>>>  } __rte_cache_min_aligned;
>>>
>>>  /* Generic Burst mode flag definition, values can be ORed. */
>>>
diff mbox series

Patch

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 58272e1..1ab3681 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -81,6 +81,12 @@  New Features
       representor=[[c#]pf#]sf# sf[0,2-1023] /* 1023 SFs.                     */
       representor=[c#]pf#      c2pf[0,1]    /* 2 PFs on controller 2.        */
 
+* **Enhanced function for getting rxq/txq info ABI.**
+  * Added new field ``queue_state`` to ``rte_eth_rxq_info`` structure to
+    provide indicated rxq queue state.
+  * Added new field ``queue_state`` to ``rte_eth_txq_info`` structure to
+    provide indicated txq queue state.
+
 * **Added support for meter PPS profile.**
 
   Currently meter algorithms only supports bytes per second(BPS).
diff --git a/lib/librte_ethdev/ethdev_driver.h b/lib/librte_ethdev/ethdev_driver.h
index 113129d..40e474a 100644
--- a/lib/librte_ethdev/ethdev_driver.h
+++ b/lib/librte_ethdev/ethdev_driver.h
@@ -952,13 +952,6 @@  struct eth_dev_ops {
 };
 
 /**
- * RX/TX queue states
- */
-#define RTE_ETH_QUEUE_STATE_STOPPED 0
-#define RTE_ETH_QUEUE_STATE_STARTED 1
-#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
-
-/**
  * @internal
  * Check if the selected Rx queue is hairpin queue.
  *
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index c73d263..d5adf4f 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -5038,6 +5038,8 @@  rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
+	qinfo->queue_state = dev->data->rx_queue_state[queue_id];
+
 	return 0;
 }
 
@@ -5078,6 +5080,7 @@  rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
+	qinfo->queue_state = dev->data->tx_queue_state[queue_id];
 
 	return 0;
 }
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 3b773b6..a0d01d2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1588,6 +1588,13 @@  struct rte_eth_dev_info {
 };
 
 /**
+ * RX/TX queue states
+ */
+#define RTE_ETH_QUEUE_STATE_STOPPED 0
+#define RTE_ETH_QUEUE_STATE_STARTED 1
+#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
+
+/**
  * Ethernet device RX queue information structure.
  * Used to retrieve information about configured queue.
  */
@@ -1595,6 +1602,7 @@  struct rte_eth_rxq_info {
 	struct rte_mempool *mp;     /**< mempool used by that queue. */
 	struct rte_eth_rxconf conf; /**< queue config parameters. */
 	uint8_t scattered_rx;       /**< scattered packets RX supported. */
+	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
 	uint16_t nb_desc;           /**< configured number of RXDs. */
 	uint16_t rx_buf_size;       /**< hardware receive buffer size. */
 } __rte_cache_min_aligned;
@@ -1606,6 +1614,7 @@  struct rte_eth_rxq_info {
 struct rte_eth_txq_info {
 	struct rte_eth_txconf conf; /**< queue config parameters. */
 	uint16_t nb_desc;           /**< configured number of TXDs. */
+	uint8_t queue_state;        /**< one of RTE_ETH_QUEUE_STATE_*. */
 } __rte_cache_min_aligned;
 
 /* Generic Burst mode flag definition, values can be ORed. */