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

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

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed
ci/iol-abi-testing warning Testing issues
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Lijun Ou April 16, 2021, 8:46 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>
---
 devtools/libabigail.abignore           | 12 +++++++++++-
 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 +++++++++
 5 files changed, 29 insertions(+), 8 deletions(-)
  

Comments

Thomas Monjalon April 16, 2021, 8:58 a.m. UTC | #1
16/04/2021 10:46, Lijun Ou:
> 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.
[...]
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -251,6 +251,12 @@ ABI Changes
>    function was already marked as internal in the API documentation for it,
>    and was not for use by external applications.
>  
> +* 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.

Not sure we should add a note here for additions which
do not break ABI compatibility.
It may be confusing.
  
Ananyev, Konstantin April 16, 2021, 9:19 a.m. UTC | #2
> 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>
> ---
>  devtools/libabigail.abignore           | 12 +++++++++++-
>  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 +++++++++
>  5 files changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
> index 6c0b389..54542a8 100644
> --- a/devtools/libabigail.abignore
> +++ b/devtools/libabigail.abignore
> @@ -19,4 +19,14 @@
>  ; Ignore fields inserted in cacheline boundary of rte_cryptodev
>  [suppress_type]
>          name = rte_cryptodev
> -        has_data_member_inserted_between = {offset_after(attached), end}
> \ No newline at end of file
> +        has_data_member_inserted_between = {offset_after(attached), end}
> +
> +; Ignore fields inserted in alignment hole of rte_eth_rxq_info
> +[suppress_type]
> +        name = rte_eth_rxq_info
> +        has_data_member_inserted_at = offset_after(scattered_rx)
> +
> +; Ignore fields inserted in cacheline boundary of rte_eth_txq_info
> +[suppress_type]
> +        name = rte_eth_txq_info
> +        has_data_member_inserted_between = {offset_after(nb_desc), end}
> diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
> index 3bd7757..c6e45e2 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -251,6 +251,12 @@ ABI Changes
>    function was already marked as internal in the API documentation for it,
>    and was not for use by external applications.
> 
> +* 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.
> +
> 
>  Known Issues
>  ------------
> 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 6b5cfd6..ab188ec 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -5042,6 +5042,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;
>  }
> 
> @@ -5082,6 +5084,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. */
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.7.4
  
Ferruh Yigit April 16, 2021, 9:41 a.m. UTC | #3
On 4/16/2021 9:58 AM, Thomas Monjalon wrote:
> 16/04/2021 10:46, Lijun Ou:
>> 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.
> [...]
>> --- a/doc/guides/rel_notes/release_21_05.rst
>> +++ b/doc/guides/rel_notes/release_21_05.rst
>> @@ -251,6 +251,12 @@ ABI Changes
>>     function was already marked as internal in the API documentation for it,
>>     and was not for use by external applications.
>>   
>> +* 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.
> 
> Not sure we should add a note here for additions which
> do not break ABI compatibility.
> It may be confusing.
> 

Hi Thomas,

What do about adding the documentation to "API Changes" section?
Since 'rte_eth_rx_queue_info_get()'/'rte_eth_tx_queue_info_get()' can get 
'queue_state' now, which may taken as API change.
  
Lijun Ou April 16, 2021, 9:55 a.m. UTC | #4
在 2021/4/16 16:58, Thomas Monjalon 写道:
> 16/04/2021 10:46, Lijun Ou:
>> 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.
> [...]
>> --- a/doc/guides/rel_notes/release_21_05.rst
>> +++ b/doc/guides/rel_notes/release_21_05.rst
>> @@ -251,6 +251,12 @@ ABI Changes
>>     function was already marked as internal in the API documentation for it,
>>     and was not for use by external applications.
>>   
>> +* 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.
> 
> Not sure we should add a note here for additions which
> do not break ABI compatibility.
> It may be confusing.
> 
Hi,Thmas&Ferruh
	Do you want to delete it?
> 
> .
>
  
Thomas Monjalon April 16, 2021, 9:57 a.m. UTC | #5
16/04/2021 11:41, Ferruh Yigit:
> On 4/16/2021 9:58 AM, Thomas Monjalon wrote:
> > 16/04/2021 10:46, Lijun Ou:
> >> 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.
> > [...]
> >> --- a/doc/guides/rel_notes/release_21_05.rst
> >> +++ b/doc/guides/rel_notes/release_21_05.rst
> >> @@ -251,6 +251,12 @@ ABI Changes
> >>     function was already marked as internal in the API documentation for it,
> >>     and was not for use by external applications.
> >>   
> >> +* 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.
> > 
> > Not sure we should add a note here for additions which
> > do not break ABI compatibility.
> > It may be confusing.
> > 
> 
> Hi Thomas,
> 
> What do about adding the documentation to "API Changes" section?
> Since 'rte_eth_rx_queue_info_get()'/'rte_eth_tx_queue_info_get()' can get 
> 'queue_state' now, which may taken as API change.

That's an addition.
The users have nothing to change in their existing code,
so I think we don't need a note in API or ABI change.
The only required note would be in the "New Features".
  
Ray Kinsella April 23, 2021, 11:08 a.m. UTC | #6
On 16/04/2021 10:57, Thomas Monjalon wrote:
> 16/04/2021 11:41, Ferruh Yigit:
>> On 4/16/2021 9:58 AM, Thomas Monjalon wrote:
>>> 16/04/2021 10:46, Lijun Ou:
>>>> 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.
>>> [...]
>>>> --- a/doc/guides/rel_notes/release_21_05.rst
>>>> +++ b/doc/guides/rel_notes/release_21_05.rst
>>>> @@ -251,6 +251,12 @@ ABI Changes
>>>>     function was already marked as internal in the API documentation for it,
>>>>     and was not for use by external applications.
>>>>   
>>>> +* 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.
>>>
>>> Not sure we should add a note here for additions which
>>> do not break ABI compatibility.
>>> It may be confusing.
>>>
>>
>> Hi Thomas,
>>
>> What do about adding the documentation to "API Changes" section?
>> Since 'rte_eth_rx_queue_info_get()'/'rte_eth_tx_queue_info_get()' can get 
>> 'queue_state' now, which may taken as API change.
> 
> That's an addition.
> The users have nothing to change in their existing code,
> so I think we don't need a note in API or ABI change.
> The only required note would be in the "New Features".

Well it definitely isn't an ABI change, however it still is an API addition.
I don't know, if additions qualify as changes.

Ray K
  
Thomas Monjalon April 25, 2021, 4:42 p.m. UTC | #7
Kinsella, Ray:
> On 16/04/2021 10:57, Thomas Monjalon wrote:
> > 16/04/2021 11:41, Ferruh Yigit:
> >> On 4/16/2021 9:58 AM, Thomas Monjalon wrote:
> >>> 16/04/2021 10:46, Lijun Ou:
> >>>> 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.
> >>> [...]
> >>>> --- a/doc/guides/rel_notes/release_21_05.rst
> >>>> +++ b/doc/guides/rel_notes/release_21_05.rst
> >>>> @@ -251,6 +251,12 @@ ABI Changes
> >>>>     function was already marked as internal in the API documentation for it,
> >>>>     and was not for use by external applications.
> >>>>   
> >>>> +* 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.
> >>>
> >>> Not sure we should add a note here for additions which
> >>> do not break ABI compatibility.
> >>> It may be confusing.
> >>>
> >>
> >> Hi Thomas,
> >>
> >> What do about adding the documentation to "API Changes" section?
> >> Since 'rte_eth_rx_queue_info_get()'/'rte_eth_tx_queue_info_get()' can get 
> >> 'queue_state' now, which may taken as API change.
> > 
> > That's an addition.
> > The users have nothing to change in their existing code,
> > so I think we don't need a note in API or ABI change.
> > The only required note would be in the "New Features".
> 
> Well it definitely isn't an ABI change, however it still is an API addition.
> I don't know, if additions qualify as changes.

Additions are already notified in the section "New Features" in general.
The purpose of the API section in the release notes is for app developers
to be warned of changes requiring attention in their maintenance.
  
Ray Kinsella April 26, 2021, 9:48 a.m. UTC | #8
On 25/04/2021 17:42, Thomas Monjalon wrote:
> Kinsella, Ray:
>> On 16/04/2021 10:57, Thomas Monjalon wrote:
>>> 16/04/2021 11:41, Ferruh Yigit:
>>>> On 4/16/2021 9:58 AM, Thomas Monjalon wrote:
>>>>> 16/04/2021 10:46, Lijun Ou:
>>>>>> 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.
>>>>> [...]
>>>>>> --- a/doc/guides/rel_notes/release_21_05.rst
>>>>>> +++ b/doc/guides/rel_notes/release_21_05.rst
>>>>>> @@ -251,6 +251,12 @@ ABI Changes
>>>>>>     function was already marked as internal in the API documentation for it,
>>>>>>     and was not for use by external applications.
>>>>>>   
>>>>>> +* 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.
>>>>>
>>>>> Not sure we should add a note here for additions which
>>>>> do not break ABI compatibility.
>>>>> It may be confusing.
>>>>>
>>>>
>>>> Hi Thomas,
>>>>
>>>> What do about adding the documentation to "API Changes" section?
>>>> Since 'rte_eth_rx_queue_info_get()'/'rte_eth_tx_queue_info_get()' can get 
>>>> 'queue_state' now, which may taken as API change.
>>>
>>> That's an addition.
>>> The users have nothing to change in their existing code,
>>> so I think we don't need a note in API or ABI change.
>>> The only required note would be in the "New Features".
>>
>> Well it definitely isn't an ABI change, however it still is an API addition.
>> I don't know, if additions qualify as changes.
> 
> Additions are already notified in the section "New Features" in general.
> The purpose of the API section in the release notes is for app developers
> to be warned of changes requiring attention in their maintenance.
> 

Understood - thanks.

Ray K
  

Patch

diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 6c0b389..54542a8 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -19,4 +19,14 @@ 
 ; Ignore fields inserted in cacheline boundary of rte_cryptodev
 [suppress_type]
         name = rte_cryptodev
-        has_data_member_inserted_between = {offset_after(attached), end}
\ No newline at end of file
+        has_data_member_inserted_between = {offset_after(attached), end}
+
+; Ignore fields inserted in alignment hole of rte_eth_rxq_info
+[suppress_type]
+        name = rte_eth_rxq_info
+        has_data_member_inserted_at = offset_after(scattered_rx)
+
+; Ignore fields inserted in cacheline boundary of rte_eth_txq_info
+[suppress_type]
+        name = rte_eth_txq_info
+        has_data_member_inserted_between = {offset_after(nb_desc), end}
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3bd7757..c6e45e2 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -251,6 +251,12 @@  ABI Changes
   function was already marked as internal in the API documentation for it,
   and was not for use by external applications.
 
+* 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.
+
 
 Known Issues
 ------------
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 6b5cfd6..ab188ec 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -5042,6 +5042,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;
 }
 
@@ -5082,6 +5084,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. */