diff mbox series

[RFC,v2,5/8] test/virtual_pmd: support get queue info device ops

Message ID 20210716142800.3853651-5-ferruh.yigit@intel.com (mailing list archive)
State Deferred
Delegated to: Thomas Monjalon
Headers show
Series [RFC,v2,1/8] test/virtual_pmd: clean rings on close | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ferruh Yigit July 16, 2021, 2:27 p.m. UTC
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test/virtual_pmd.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index f2d807de8d89..e0ea213ae231 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -31,6 +31,8 @@  struct virtual_ethdev_private {
 struct virtual_ethdev_queue {
 	int port_id;
 	int queue_id;
+	uint16_t nb_desc;
+	struct rte_eth_rxconf rx_conf;
 };
 
 static int
@@ -106,9 +108,9 @@  virtual_ethdev_info_get(struct rte_eth_dev *dev __rte_unused,
 
 static int
 virtual_ethdev_rx_queue_setup_success(struct rte_eth_dev *dev,
-		uint16_t rx_queue_id, uint16_t nb_rx_desc __rte_unused,
+		uint16_t rx_queue_id, uint16_t nb_rx_desc,
 		unsigned int socket_id,
-		const struct rte_eth_rxconf *rx_conf __rte_unused,
+		const struct rte_eth_rxconf *rx_conf,
 		struct rte_mempool *mb_pool __rte_unused)
 {
 	struct virtual_ethdev_queue *rx_q;
@@ -121,6 +123,8 @@  virtual_ethdev_rx_queue_setup_success(struct rte_eth_dev *dev,
 
 	rx_q->port_id = dev->data->port_id;
 	rx_q->queue_id = rx_queue_id;
+	rx_q->nb_desc = nb_rx_desc;
+	rx_q->rx_conf = *rx_conf;
 
 	dev->data->rx_queues[rx_queue_id] = rx_q;
 
@@ -159,6 +163,23 @@  virtual_ethdev_tx_queue_setup_success(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static void
+virtual_ethdev_rx_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+		struct rte_eth_rxq_info *qinfo)
+{
+	struct virtual_ethdev_queue *rx_q = dev->data->rx_queues[rx_queue_id];
+
+	qinfo->nb_desc = rx_q->nb_desc;
+	qinfo->conf = rx_q->rx_conf;
+}
+
+static void
+virtual_ethdev_tx_info_get(struct rte_eth_dev *dev __rte_unused,
+		uint16_t tx_queue_id __rte_unused,
+		struct rte_eth_txq_info *qinfo __rte_unused)
+{
+}
+
 static int
 virtual_ethdev_tx_queue_setup_fail(struct rte_eth_dev *dev __rte_unused,
 		uint16_t tx_queue_id __rte_unused, uint16_t nb_tx_desc __rte_unused,
@@ -248,6 +269,8 @@  static const struct eth_dev_ops virtual_ethdev_default_dev_ops = {
 	.dev_infos_get = virtual_ethdev_info_get,
 	.rx_queue_setup = virtual_ethdev_rx_queue_setup_success,
 	.tx_queue_setup = virtual_ethdev_tx_queue_setup_success,
+	.rxq_info_get = virtual_ethdev_rx_info_get,
+	.txq_info_get = virtual_ethdev_tx_info_get,
 	.rx_queue_release = virtual_ethdev_rx_queue_release,
 	.tx_queue_release = virtual_ethdev_tx_queue_release,
 	.link_update = virtual_ethdev_link_update_success,