From: Shijith Thotton <sthotton@marvell.com>
To: <jerinj@marvell.com>
Cc: <pbhagavatula@marvell.com>,
Shijith Thotton <sthotton@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 3/3] test/event: unit test to burst add Rx queues to adapter
Date: Fri, 7 Feb 2025 19:39:10 +0530 [thread overview]
Message-ID: <20250207140910.721374-4-sthotton@marvell.com> (raw)
In-Reply-To: <20250207140910.721374-1-sthotton@marvell.com>
Added unit test for adding queues to Rx adapter in bursts using
rte_event_eth_rx_adapter_queues_add().
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
app/test/test_event_eth_rx_adapter.c | 86 ++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 0233c87779..92b7ff6d99 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -9,6 +9,7 @@
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_malloc.h>
#ifdef RTE_EXEC_ENV_WINDOWS
static int
@@ -819,6 +820,89 @@ adapter_queue_add_del(void)
return TEST_SUCCESS;
}
+static int
+adapter_queues_add_del(void)
+{
+ struct rte_event_eth_rx_adapter_queue_conf *queue_conf;
+ struct rte_event_dev_info event_dev_info;
+ struct rte_eth_dev_info dev_info;
+ uint16_t i, max_rx_queues;
+ int32_t *rx_queue_ids;
+ struct rte_event ev;
+ uint32_t cap;
+ int 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);
+
+ err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ max_rx_queues = RTE_MIN(dev_info.max_rx_queues, MAX_NUM_RX_QUEUE);
+
+ err = rte_event_dev_info_get(TEST_DEV_ID, &event_dev_info);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ queue_conf = rte_zmalloc(NULL, sizeof(*queue_conf) * max_rx_queues, 0);
+ TEST_ASSERT(queue_conf != NULL, "Failed to allocate memory");
+
+ rx_queue_ids = rte_zmalloc(NULL, sizeof(*rx_queue_ids) * max_rx_queues, 0);
+ TEST_ASSERT(rx_queue_ids != NULL, "Failed to allocate memory");
+
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ for (i = 0; i < max_rx_queues; i++) {
+ rx_queue_ids[i] = i;
+ ev.queue_id = i % event_dev_info.max_event_queues;
+ if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) {
+ ev.flow_id = 1;
+ queue_conf[i].rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+ }
+ queue_conf[i].ev = ev;
+ queue_conf[i].servicing_weight = 1;
+ }
+
+ err = rte_event_eth_rx_adapter_queues_add(TEST_INST_ID,
+ rte_eth_dev_count_total(),
+ rx_queue_ids, queue_conf, 0);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queues_add(TEST_INST_ID + 1, TEST_ETHDEV_ID,
+ NULL, queue_conf, 0);
+ TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err);
+
+ err = rte_event_eth_rx_adapter_queues_add(TEST_INST_ID, TEST_ETHDEV_ID,
+ rx_queue_ids, queue_conf, 1);
+ 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);
+
+ if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) {
+ err = rte_event_eth_rx_adapter_queues_add(
+ TEST_INST_ID, TEST_ETHDEV_ID, rx_queue_ids, queue_conf,
+ max_rx_queues);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, -1);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ } else {
+ err = rte_event_eth_rx_adapter_queues_add(
+ TEST_INST_ID, TEST_ETHDEV_ID, NULL, queue_conf, 0);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+
+ err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+ TEST_ETHDEV_ID, -1);
+ TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+ }
+
+ rte_free(rx_queue_ids);
+ rte_free(queue_conf);
+
+ return TEST_SUCCESS;
+}
+
static int
adapter_multi_eth_add_del(void)
{
@@ -1423,6 +1507,8 @@ static struct unit_test_suite event_eth_rx_tests = {
TEST_CASE_ST(NULL, NULL, adapter_create_free_with_params),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_queue_add_del),
+ TEST_CASE_ST(adapter_create, adapter_free,
+ adapter_queues_add_del),
TEST_CASE_ST(adapter_create, adapter_free,
adapter_multi_eth_add_del),
TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
--
2.25.1
prev parent reply other threads:[~2025-02-07 14:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 14:09 [PATCH 0/3] Rx adapter API to add Rx queues in burst Shijith Thotton
2025-02-07 14:09 ` [PATCH 1/3] eventdev/eth_rx: add API to burst add queues to Rx adapter Shijith Thotton
2025-02-07 14:09 ` [PATCH 2/3] event/cnxk: enable PMD op " Shijith Thotton
2025-02-07 14:09 ` Shijith Thotton [this message]
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=20250207140910.721374-4-sthotton@marvell.com \
--to=sthotton@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=pbhagavatula@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).