DPDK patches and discussions
 help / color / mirror / Atom feed
From: Naga Harish K S V <s.v.naga.harish.k@intel.com>
To: jerinj@marvell.com, jay.jayatheerthan@intel.com
Cc: dev@dpdk.org
Subject: [PATCH v2 2/2] test/eth_tx: add testcase for queue start stop APIs
Date: Thu, 15 Sep 2022 04:53:29 -0500	[thread overview]
Message-ID: <20220915095329.2217018-2-s.v.naga.harish.k@intel.com> (raw)
In-Reply-To: <20220915095329.2217018-1-s.v.naga.harish.k@intel.com>

Added testcase for rte_event_eth_tx_adapter_queue_start()
and rte_event_eth_tx_adapter_queue_stop() APIs.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 app/test/test_event_eth_tx_adapter.c | 86 ++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index 98debfdd2c..c19a87a86a 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -711,6 +711,90 @@ tx_adapter_instance_get(void)
 	return TEST_SUCCESS;
 }
 
+static int
+tx_adapter_queue_start_stop(void)
+{
+	int err;
+	uint16_t eth_dev_id;
+	struct rte_eth_dev_info dev_info;
+
+	/* Case 1: Test without adding eth Tx queue */
+	err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_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_tx_adapter_queue_start(eth_dev_id,
+						    TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_stop(eth_dev_id,
+						    TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 3: Test with wrong tx 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_tx_adapter_queue_start(TEST_ETHDEV_ID,
+						    dev_info.max_tx_queues + 1);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID,
+						    dev_info.max_tx_queues + 1);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Case 4: Test with right instance, port & rxq */
+	/* Add queue to tx adapter */
+	err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	/* Add another queue to tx adapter */
+	err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 TEST_ETH_QUEUE_ID + 1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	/* Case 5: Test with right instance, port & wrong rxq */
+	err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 2);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID,
+						    TEST_ETH_QUEUE_ID + 2);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	/* Delete all queues from the Tx adapter */
+	err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID,
+						 TEST_ETHDEV_ID,
+						 -1);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	return TEST_SUCCESS;
+}
+
 static int
 tx_adapter_dynamic_device(void)
 {
@@ -770,6 +854,8 @@ static struct unit_test_suite event_eth_tx_tests = {
 					tx_adapter_service),
 		TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
 					tx_adapter_instance_get),
+		TEST_CASE_ST(tx_adapter_create, tx_adapter_free,
+					tx_adapter_queue_start_stop),
 		TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
-- 
2.25.1


  reply	other threads:[~2022-09-15  9:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09  3:42 [PATCH 1/3] eventdev/eth_tx: add queue start stop API Naga Harish K S V
2022-09-09  3:42 ` [PATCH 2/3] test/eth_tx: add testcase for queue start stop APIs Naga Harish K S V
2022-09-09  3:42 ` [PATCH 3/3] doc: added eth Tx adapter " Naga Harish K S V
2022-09-14 15:20 ` [PATCH 1/3] eventdev/eth_tx: add queue start stop API Jerin Jacob
2022-09-16  5:21   ` Naga Harish K, S V
2022-09-16  6:10   ` Jayatheerthan, Jay
2022-09-16 15:18     ` Naga Harish K, S V
2022-09-15  9:53 ` [PATCH v2 1/2] " Naga Harish K S V
2022-09-15  9:53   ` Naga Harish K S V [this message]
2022-09-15 15:19   ` [PATCH v3 " Naga Harish K S V
2022-09-15 15:19     ` [PATCH v3 2/2] test/eth_tx: add testcase for queue start stop APIs Naga Harish K S V
2022-09-16 15:15     ` [PATCH v4 1/2] eventdev/eth_tx: add queue start stop API Naga Harish K S V
2022-09-16 15:15       ` [PATCH v4 2/2] test/eth_tx: add testcase for queue start stop APIs Naga Harish K S V
2022-09-16 16:23     ` [PATCH v5 1/2] eventdev/eth_tx: add queue start stop API Naga Harish K S V
2022-09-16 16:23       ` [PATCH v5 2/2] test/eth_tx: add testcase for queue start stop APIs Naga Harish K S V
2022-09-26  2:04       ` [PATCH v6 1/2] eventdev/eth_tx: add queue start stop API Naga Harish K S V
2022-09-26  2:04         ` [PATCH v6 2/2] test/eth_tx: add testcase for queue start stop APIs Naga Harish K S V
2022-09-27 10:15         ` [PATCH v6 1/2] eventdev/eth_tx: add queue start stop API Jerin Jacob
2022-09-27 10:28           ` Jayatheerthan, Jay
2022-09-28  3:46             ` 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=20220915095329.2217018-2-s.v.naga.harish.k@intel.com \
    --to=s.v.naga.harish.k@intel.com \
    --cc=dev@dpdk.org \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinj@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).