[dpdk-dev] [PATCH] ethdev: add queue state when retrieve queue information

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Mon Mar 22 15:49:25 CET 2021


On 3/22/21 12:22 PM, Ferruh Yigit wrote:
> On 3/18/2021 12:25 PM, 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: The hairpin queue is not supported with above
>> rte_eth_*x_queue_info_get, so the queue state could be
>> RTE_ETH_QUEUE_STATE_STARTED or RTE_ETH_QUEUE_STATE_STOPPED.
>> 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 at huawei.com>
>> Signed-off-by: Lijun Ou <oulijun at huawei.com>
> 
> <...>
> 
>> diff --git a/lib/librte_ethdev/rte_ethdev.h
>> b/lib/librte_ethdev/rte_ethdev.h
>> index efda313..3b83c5a 100644
>> --- a/lib/librte_ethdev/rte_ethdev.h
>> +++ b/lib/librte_ethdev/rte_ethdev.h
>> @@ -1591,6 +1591,8 @@ struct rte_eth_rxq_info {
>>       uint8_t scattered_rx;       /**< scattered packets RX supported. */
>>       uint16_t nb_desc;           /**< configured number of RXDs. */
>>       uint16_t rx_buf_size;       /**< hardware receive buffer size. */
>> +    /**< Queues state: STARTED(1) / STOPPED(0). */
>> +    uint8_t queue_state;
>>   } __rte_cache_min_aligned;
>>     /**
>> @@ -1600,6 +1602,8 @@ 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. */
>> +    /**< Queues state: STARTED(1) / STOPPED(0). */
>> +    uint8_t queue_state;
>>   } __rte_cache_min_aligned;
>>     /* Generic Burst mode flag definition, values can be ORed. */
>>
> 
> This is causing an ABI warning [1], but I guess it is safe since the
> size of the struct is not changing (cache align). Adding a few more
> people to comment.
> 
> 
> [1]
> https://travis-ci.com/github/ovsrobot/dpdk/builds/220497651

Frankly speaking I dislike addition of queue_state as uint8_t.
IMHO it should be either 'bool started' or enum to support more
states in the future if we need.


More information about the dev mailing list