All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ganapati Kundapura <ganapati.kundapura@intel.com>
To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com,
	s.v.naga.harish.k@intel.com
Subject: [PATCH v7 3/7] test/eth_rx: add test case for instance get API
Date: Wed, 22 Jun 2022 05:37:52 -0500	[thread overview]
Message-ID: <20220622103756.421869-3-ganapati.kundapura@intel.com> (raw)
In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com>

Added test case for rte_event_eth_rx_adapter_instance_get()

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
 app/test/test_event_eth_rx_adapter.c | 203 ++++++++++++++++++++++++++++++++++-
 1 file changed, 202 insertions(+), 1 deletion(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index e358a70..1da7782 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -39,6 +39,7 @@ test_event_eth_rx_intr_adapter_common(void)
 #define TEST_INST_ID		0
 #define TEST_DEV_ID		0
 #define TEST_ETHDEV_ID		0
+#define TEST_ETH_QUEUE_ID	0
 
 struct event_eth_rx_adapter_test_params {
 	struct rte_mempool *mp;
@@ -1001,6 +1002,202 @@ adapter_queue_conf(void)
 	return TEST_SUCCESS;
 }
 
+static int
+adapter_pollq_instance_get(void)
+{
+	int err;
+	uint8_t inst_id;
+	uint16_t eth_dev_id;
+	struct rte_eth_dev_info dev_info;
+	struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0};
+
+	/* Case 1: Test without configuring eth */
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 2: Test with wrong eth port */
+	eth_dev_id = rte_eth_dev_count_total() + 1;
+	err = rte_event_eth_rx_adapter_instance_get(eth_dev_id,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 3: Test with wrong rx queue */
+	err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    dev_info.max_rx_queues + 1,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 4: Test with right instance, port & rxq */
+	/* Add queue 1 to Rx adapter */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID;
+	queue_conf.ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+	queue_conf.ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
+	queue_conf.servicing_weight = 1; /* poll queue */
+
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Add queue 2 to Rx adapter */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 1;
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID + 1,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 1,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Add queue 3 to Rx adapter */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 2;
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID + 2,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 2,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Case 5: Test with right instance, port & wrong rxq */
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 3,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Delete all queues from the Rx adapter */
+	err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 -1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	return TEST_SUCCESS;
+}
+
+static int
+adapter_intrq_instance_get(void)
+{
+	int err;
+	uint8_t inst_id;
+	uint16_t eth_dev_id;
+	struct rte_eth_dev_info dev_info;
+	struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0};
+
+	/* Case 1: Test without configuring eth */
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 2: Test with wrong eth port */
+	eth_dev_id = rte_eth_dev_count_total() + 1;
+	err = rte_event_eth_rx_adapter_instance_get(eth_dev_id,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 3: Test with wrong rx queue */
+	err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    dev_info.max_rx_queues + 1,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 4: Test with right instance, port & rxq */
+	/* Intr enabled eth device can have both polled and intr queues.
+	 * Add polled queue 1 to Rx adapter
+	 */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID;
+	queue_conf.ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+	queue_conf.ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
+	queue_conf.servicing_weight = 1; /* poll queue */
+
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Add intr queue 2 to Rx adapter */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 1;
+	queue_conf.servicing_weight = 0; /* intr  queue */
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID + 1,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 1,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Add intr queue 3 to Rx adapter */
+	queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 2;
+	queue_conf.servicing_weight = 0; /* intr  queue */
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID + 2,
+						 &queue_conf);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 2,
+						    &inst_id);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d",
+		    TEST_INST_ID, err);
+
+	/* Case 5: Test with right instance, port & wrong rxq */
+	err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 3,
+						    &inst_id);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Delete all queues from the Rx adapter */
+	err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 -1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	return TEST_SUCCESS;
+}
+
 static struct unit_test_suite event_eth_rx_tests = {
 	.suite_name = "rx event eth adapter test suite",
 	.setup = testsuite_setup,
@@ -1019,6 +1216,8 @@ static struct unit_test_suite event_eth_rx_tests = {
 			     adapter_queue_event_buf_test),
 		TEST_CASE_ST(adapter_create_with_params, adapter_free,
 			     adapter_queue_stats_test),
+		TEST_CASE_ST(adapter_create, adapter_free,
+			     adapter_pollq_instance_get),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
@@ -1029,7 +1228,9 @@ static struct unit_test_suite event_eth_rx_intr_tests = {
 	.teardown = testsuite_teardown_rx_intr,
 	.unit_test_cases = {
 		TEST_CASE_ST(adapter_create, adapter_free,
-			adapter_intr_queue_add_del),
+			     adapter_intr_queue_add_del),
+		TEST_CASE_ST(adapter_create, adapter_free,
+			     adapter_intrq_instance_get),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
-- 
2.6.4


  parent reply	other threads:[~2022-06-22 10:38 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 17:25 [PATCH v1] eventdev: add adapter instance get API Ganapati Kundapura
2022-06-07  8:07 ` [PATCH v2] " Ganapati Kundapura
2022-06-07  8:21   ` [PATCH v3] " Ganapati Kundapura
2022-06-07 13:18     ` Jayatheerthan, Jay
2022-06-08 11:23       ` Kundapura, Ganapati
2022-06-07 15:13     ` [PATCH v4] " Ganapati Kundapura
2022-06-08  4:26       ` Naga Harish K, S V
2022-06-08 11:22         ` Kundapura, Ganapati
2022-06-08 11:16       ` [PATCH v5 1/7] eventdev/eth_rx: " Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-08 11:16         ` [PATCH v5 7/7] doc/eth_tx: " Ganapati Kundapura
2022-06-08 12:13         ` [PATCH v6 1/7] eventdev/eth_rx: add adapter " Ganapati Kundapura
2022-06-08 12:13           ` [PATCH v6 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-08 12:13           ` [PATCH v6 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-06-08 12:13           ` [PATCH v6 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-06-10  4:14             ` Naga Harish K, S V
2022-06-08 12:13           ` [PATCH v6 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-08 12:13           ` [PATCH v6 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-08 12:14           ` [PATCH v6 7/7] doc/eth_tx: " Ganapati Kundapura
2022-06-10  4:12           ` [PATCH v6 1/7] eventdev/eth_rx: add adapter " Naga Harish K, S V
2022-06-22 10:37           ` [PATCH v7 " Ganapati Kundapura
2022-06-22 10:37             ` [PATCH v7 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-22 10:37             ` Ganapati Kundapura [this message]
2022-06-22 10:37             ` [PATCH v7 4/7] eventdev/eth_tx: add instance get API Ganapati Kundapura
2022-06-22 10:37             ` [PATCH v7 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-22 10:37             ` [PATCH v7 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-22 10:37             ` [PATCH v7 7/7] doc/eth_tx: " Ganapati Kundapura
2022-06-22 16:53             ` [PATCH v8 1/7] eventdev/eth_rx: add adapter " Ganapati Kundapura
2022-06-22 16:54               ` [PATCH v8 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-22 17:29                 ` Naga Harish K, S V
2022-06-22 16:54               ` [PATCH v8 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-06-22 17:29                 ` Naga Harish K, S V
2022-06-22 16:54               ` [PATCH v8 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-06-22 17:30                 ` Naga Harish K, S V
2022-06-22 16:54               ` [PATCH v8 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-22 17:30                 ` Naga Harish K, S V
2022-06-22 16:54               ` [PATCH v8 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-22 17:30                 ` Naga Harish K, S V
2022-06-22 16:54               ` [PATCH v8 7/7] doc/eth_tx: " Ganapati Kundapura
2022-06-22 17:30                 ` Naga Harish K, S V
2022-06-22 17:41                 ` Jayatheerthan, Jay
2022-06-22 17:29               ` [PATCH v8 1/7] eventdev/eth_rx: add adapter " Naga Harish K, S V
2022-06-22 17:44               ` Jayatheerthan, Jay
2022-06-23  6:24               ` [PATCH v9 " Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-23  6:24                 ` [PATCH v9 7/7] doc/eth_tx: " Ganapati Kundapura
2022-06-23  9:30                 ` [PATCH v10 1/7] eventdev/eth_rx: add adapter " Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-06-23  9:30                   ` [PATCH v10 7/7] doc/eth_tx: " Ganapati Kundapura
2022-07-19  8:25                   ` [PATCH v11 1/7] eventdev/eth_rx: add adapter " Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 2/7] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 3/7] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 4/7] eventdev/eth_tx: add " Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 5/7] test/eth_tx: add testcase for " Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 6/7] doc/eth_rx: update " Ganapati Kundapura
2022-07-19  8:25                     ` [PATCH v11 7/7] doc/eth_tx: " Ganapati Kundapura
2022-08-11 13:28                     ` [PATCH v11 1/7] eventdev/eth_rx: add adapter " Kundapura, Ganapati
2022-08-27 12:14                       ` Jerin Jacob
2022-08-29  8:20                         ` Kundapura, Ganapati
2022-08-29  8:14                     ` [PATCH v12 1/6] " Ganapati Kundapura
2022-08-29  8:14                       ` [PATCH v12 2/6] eventdev/eth_rx: add telemetry callback for instance get Ganapati Kundapura
2022-08-29  8:14                       ` [PATCH v12 3/6] test/eth_rx: add test case for instance get API Ganapati Kundapura
2022-08-29  8:14                       ` [PATCH v12 4/6] eventdev/eth_tx: add " Ganapati Kundapura
2022-09-02 13:10                         ` Jerin Jacob
2022-08-29  8:14                       ` [PATCH v12 5/6] test/eth_tx: add testcase for " Ganapati Kundapura
2022-08-29  8:14                       ` [PATCH v12 6/6] doc: Added adapter " Ganapati Kundapura
2022-08-29  8:14                       ` [PATCH v12 6/6] doc: added " Ganapati Kundapura
2022-09-02 13:11                         ` Jerin Jacob
2022-09-02 13:09                       ` [PATCH v12 1/6] eventdev/eth_rx: add " Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622103756.421869-3-ganapati.kundapura@intel.com \
    --to=ganapati.kundapura@intel.com \
    --cc=dev@dpdk.org \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinj@marvell.com \
    --cc=s.v.naga.harish.k@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.