From 7516c1b63b53a27215a0206ae1437a3d5d5d0e08 Mon Sep 17 00:00:00 2001 From: Lijun Ou Date: Mon, 19 Apr 2021 16:57:30 +0800 Subject: [PATCH 174/189] ethdev: add queue state in queried queue information 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 Signed-off-by: Lijun Ou Acked-by: Konstantin Ananyev Acked-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- devtools/libabigail.abignore | 9 +++++++++ lib/librte_ethdev/rte_ethdev.c | 3 +++ lib/librte_ethdev/rte_ethdev.h | 9 +++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 7 ------- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index 025f2c0..b649af1 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -7,3 +7,12 @@ symbol_version = INTERNAL [suppress_variable] symbol_version = INTERNAL +; 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/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index f311868..87d1b56 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -5023,6 +5023,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; } @@ -5063,6 +5065,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 e89fc50..d9ab66d 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1562,6 +1562,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. */ @@ -1569,6 +1576,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; @@ -1580,6 +1588,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 --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 0eacfd8..6d928a4 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -920,13 +920,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. * -- 2.7.4