From patchwork Tue Oct 3 07:51:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 132272 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4233426AC; Tue, 3 Oct 2023 09:51:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CE78402F0; Tue, 3 Oct 2023 09:51:38 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0BCBF402E6 for ; Tue, 3 Oct 2023 09:51:36 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3932411B028261; Tue, 3 Oct 2023 00:51:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ZJomz5zTA8m69IZNHb808fZ1P2VqJ190A/q3QZbPVlA=; b=YvRlNNPmaFAYV4/lVAGmH4yoyxcgyXsVvw2H/i02uVdkAXKbSDqYeEmzEtPSb8w8gZPj 51kKx6q/joMibR42nHxbtTdplT0q7dBLJL7vCa8T1OQlK+wRbtNX0VvTkl5xtkUlPImh hXRet9qMqI3AwmKWjekPDT9l52wDdkSlpKkE9EV79RUOWzgOveudiP2iCHwSl+GvgQcD 7EonHXZjqfmuSLiiqtsVyvWejMXi0Yqp/uo54+UAoxBcF1Nbw/ShtNsF6iRyci0ywd1y 4bMHORNNr0IgsFNDpdl0UTB8E4bkw7FHDLX9jYpmGXgZwCf30QsGCHTKJYLPzLsbt79H mA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3tek6myatk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 00:51:36 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 3 Oct 2023 00:51:34 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 3 Oct 2023 00:51:33 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id A83C53F7055; Tue, 3 Oct 2023 00:51:27 -0700 (PDT) From: To: , , , , , , , , , , , , , CC: Subject: [PATCH v5 3/3] test/event: add event link profile test Date: Tue, 3 Oct 2023 13:21:09 +0530 Message-ID: <20231003075109.4309-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231003075109.4309-1-pbhagavatula@marvell.com> References: <20230928101205.4352-1-pbhagavatula@marvell.com> <20231003075109.4309-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: zgy1H4GbrtE_wt54Fb9zr7wq5xYelvPz X-Proofpoint-GUID: zgy1H4GbrtE_wt54Fb9zr7wq5xYelvPz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-03_04,2023-10-02_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Pavan Nikhilesh Add test case to verify event link profiles. Signed-off-by: Pavan Nikhilesh --- app/test/test_eventdev.c | 117 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c index c51c93bdbd..0ecfa7db02 100644 --- a/app/test/test_eventdev.c +++ b/app/test/test_eventdev.c @@ -1129,6 +1129,121 @@ test_eventdev_link_get(void) return TEST_SUCCESS; } +static int +test_eventdev_profile_switch(void) +{ +#define MAX_RETRIES 4 + uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV]; + uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV]; + struct rte_event_queue_conf qcfg; + struct rte_event_port_conf pcfg; + struct rte_event_dev_info info; + struct rte_event ev; + uint8_t q, re; + int rc; + + rte_event_dev_info_get(TEST_DEV_ID, &info); + + if (info.max_profiles_per_port <= 1) + return TEST_SKIPPED; + + if (info.max_event_queues <= 1) + return TEST_SKIPPED; + + rc = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pcfg); + TEST_ASSERT_SUCCESS(rc, "Failed to get port0 default config"); + rc = rte_event_port_setup(TEST_DEV_ID, 0, &pcfg); + TEST_ASSERT_SUCCESS(rc, "Failed to setup port0"); + + rc = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qcfg); + TEST_ASSERT_SUCCESS(rc, "Failed to get queue0 default config"); + rc = rte_event_queue_setup(TEST_DEV_ID, 0, &qcfg); + TEST_ASSERT_SUCCESS(rc, "Failed to setup queue0"); + + q = 0; + rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 0); + TEST_ASSERT(rc == 1, "Failed to link queue 0 to port 0 with profile 0"); + q = 1; + rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 1); + TEST_ASSERT(rc == 1, "Failed to link queue 1 to port 0 with profile 1"); + + rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 0); + TEST_ASSERT(rc == 1, "Failed to links"); + TEST_ASSERT(queues[0] == 0, "Invalid queue found in link"); + + rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 1); + TEST_ASSERT(rc == 1, "Failed to links"); + TEST_ASSERT(queues[0] == 1, "Invalid queue found in link"); + + rc = rte_event_dev_start(TEST_DEV_ID); + TEST_ASSERT_SUCCESS(rc, "Failed to start event device"); + + ev.event_type = RTE_EVENT_TYPE_CPU; + ev.queue_id = 0; + ev.op = RTE_EVENT_OP_NEW; + ev.flow_id = 0; + ev.u64 = 0xBADF00D0; + rc = rte_event_enqueue_burst(TEST_DEV_ID, 0, &ev, 1); + TEST_ASSERT(rc == 1, "Failed to enqueue event"); + ev.queue_id = 1; + ev.flow_id = 1; + rc = rte_event_enqueue_burst(TEST_DEV_ID, 0, &ev, 1); + TEST_ASSERT(rc == 1, "Failed to enqueue event"); + + ev.event = 0; + ev.u64 = 0; + + rc = rte_event_port_profile_switch(TEST_DEV_ID, 0, 1); + TEST_ASSERT_SUCCESS(rc, "Failed to change profile"); + + re = MAX_RETRIES; + while (re--) { + rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0); + printf("rc %d\n", rc); + if (rc) + break; + } + + TEST_ASSERT(rc == 1, "Failed to dequeue event from profile 1"); + TEST_ASSERT(ev.flow_id == 1, "Incorrect flow identifier from profile 1"); + TEST_ASSERT(ev.queue_id == 1, "Incorrect queue identifier from profile 1"); + + re = MAX_RETRIES; + while (re--) { + rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0); + TEST_ASSERT(rc == 0, "Unexpected event dequeued from active profile"); + } + + rc = rte_event_port_profile_switch(TEST_DEV_ID, 0, 0); + TEST_ASSERT_SUCCESS(rc, "Failed to change profile"); + + re = MAX_RETRIES; + while (re--) { + rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0); + if (rc) + break; + } + + TEST_ASSERT(rc == 1, "Failed to dequeue event from profile 1"); + TEST_ASSERT(ev.flow_id == 0, "Incorrect flow identifier from profile 0"); + TEST_ASSERT(ev.queue_id == 0, "Incorrect queue identifier from profile 0"); + + re = MAX_RETRIES; + while (re--) { + rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0); + TEST_ASSERT(rc == 0, "Unexpected event dequeued from active profile"); + } + + q = 0; + rc = rte_event_port_profile_unlink(TEST_DEV_ID, 0, &q, 1, 0); + TEST_ASSERT(rc == 1, "Failed to unlink queue 0 to port 0 with profile 0"); + q = 1; + rc = rte_event_port_profile_unlink(TEST_DEV_ID, 0, &q, 1, 1); + TEST_ASSERT(rc == 1, "Failed to unlink queue 1 to port 0 with profile 1"); + + return TEST_SUCCESS; +} + static int test_eventdev_close(void) { @@ -1187,6 +1302,8 @@ static struct unit_test_suite eventdev_common_testsuite = { test_eventdev_timeout_ticks), TEST_CASE_ST(NULL, NULL, test_eventdev_start_stop), + TEST_CASE_ST(eventdev_configure_setup, eventdev_stop_device, + test_eventdev_profile_switch), TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device, test_eventdev_link), TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device,