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: [dpdk-dev] [PATCH v2 3/3] test/event: add unit test for Rx adapter
Date: Thu, 28 Oct 2021 02:06:40 -0500	[thread overview]
Message-ID: <20211028070640.3051397-3-s.v.naga.harish.k@intel.com> (raw)
In-Reply-To: <20211028070640.3051397-1-s.v.naga.harish.k@intel.com>

add unit test for rte_event_eth_rx_adapter_queue_stats_get() and
rte_event_eth_rx_adapter_queue_stats_reset() apis.

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

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 1419f6f64d..7cb91b152f 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -471,6 +471,64 @@ adapter_queue_event_buf_test(void)
 	return TEST_SUCCESS;
 }
 
+static int
+adapter_queue_stats_test(void)
+{
+	int err;
+	struct rte_event ev;
+	uint32_t cap;
+	struct rte_event_eth_rx_adapter_queue_conf queue_config = {0};
+	struct rte_event_eth_rx_adapter_queue_stats q_stats;
+
+	err = rte_event_eth_rx_adapter_queue_stats_get(TEST_INST_ID,
+						TEST_ETHDEV_ID, 0,
+						&q_stats);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_rx_adapter_queue_stats_reset(TEST_INST_ID,
+						TEST_ETHDEV_ID, 0);
+	TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+	err = rte_event_eth_rx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID,
+					 &cap);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	ev.queue_id = 0;
+	ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+	ev.priority = 0;
+
+	queue_config.rx_queue_flags = 0;
+	if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) {
+		ev.flow_id = 1;
+		queue_config.rx_queue_flags =
+			RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+	}
+	queue_config.ev = ev;
+	queue_config.servicing_weight = 1;
+	queue_config.event_buf_size = 1024;
+
+	err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+					TEST_ETHDEV_ID, 0,
+					&queue_config);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_queue_stats_get(TEST_INST_ID,
+						TEST_ETHDEV_ID, 0,
+						&q_stats);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_queue_stats_reset(TEST_INST_ID,
+						TEST_ETHDEV_ID, 0);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+						TEST_ETHDEV_ID,
+						0);
+	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+	return TEST_SUCCESS;
+}
+
 static void
 adapter_free(void)
 {
@@ -940,6 +998,8 @@ static struct unit_test_suite event_eth_rx_tests = {
 		TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf),
 		TEST_CASE_ST(adapter_create_with_params, adapter_free,
 			     adapter_queue_event_buf_test),
+		TEST_CASE_ST(adapter_create_with_params, adapter_free,
+			     adapter_queue_stats_test),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
-- 
2.25.1


  parent reply	other threads:[~2021-10-28  7:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28  4:54 [dpdk-dev] [PATCH 1/3] eventdev/eth_rx: add queue stats get and reset APIs Naga Harish K S V
2021-10-28  4:54 ` [dpdk-dev] [PATCH 2/3] eventdev/eth_rx: support telemetry Naga Harish K S V
2021-10-28  4:54 ` [dpdk-dev] [PATCH 3/3] test/event: add unit test for Rx adapter Naga Harish K S V
2021-10-28  6:55 ` [dpdk-dev] [PATCH v2 1/3] eventdev/eth_rx: add queue stats get and reset APIs Naga Harish K S V
2021-10-28  6:55   ` [dpdk-dev] [PATCH v2 2/3] eventdev/eth_rx: support telemetry Naga Harish K S V
2021-10-28  6:55   ` [dpdk-dev] [PATCH v2 3/3] test/event: add unit test for Rx adapter Naga Harish K S V
2021-10-28  7:06 ` [dpdk-dev] [PATCH v2 1/3] eventdev/eth_rx: add queue stats get and reset APIs Naga Harish K S V
2021-10-28  7:06   ` [dpdk-dev] [PATCH v2 2/3] eventdev/eth_rx: support telemetry Naga Harish K S V
2021-10-28  7:06   ` Naga Harish K S V [this message]
2021-10-28  8:10   ` [dpdk-dev] [PATCH v2 1/3] eventdev/eth_rx: add queue stats get and reset APIs Jayatheerthan, Jay
2021-10-28 10:27   ` [dpdk-dev] [PATCH v3 " Naga Harish K S V
2021-10-28 10:27     ` [dpdk-dev] [PATCH v3 2/3] eventdev/eth_rx: support telemetry Naga Harish K S V
2021-10-28 10:27     ` [dpdk-dev] [PATCH v3 3/3] test/event: add unit test for Rx adapter Naga Harish K S V
2021-11-02 11:00     ` [dpdk-dev] [PATCH v3 1/3] eventdev/eth_rx: add queue stats get and reset APIs Jerin Jacob
2021-10-28 10:37   ` Naga Harish K S V
2021-10-28 10:37     ` [dpdk-dev] [PATCH v3 2/3] eventdev/eth_rx: support telemetry Naga Harish K S V
2021-10-28 10:37     ` [dpdk-dev] [PATCH v3 3/3] test/event: add unit test for Rx adapter Naga Harish K S V

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=20211028070640.3051397-3-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).