From patchwork Tue Oct 3 09:47:21 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: 132275 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 1C940426AE; Tue, 3 Oct 2023 11:47:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA11A40608; Tue, 3 Oct 2023 11:47:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 63AAD40608 for ; Tue, 3 Oct 2023 11:47:48 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3933jmVU023432; Tue, 3 Oct 2023 02:47:47 -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=DTxH8SN9F+HU6ACwJa5c1O7p+YGei3+OM6KoBiHbwqBChXvy1L4bH1Z8NUx8PbJLUsTd 0aBIsitVl656uxPpy9QrH1UNQ3V86rJWToSZFeHaqQjL34qF0GLOhQ5Bo1KLVP/lOttM +tYO9MbS2Cx0A/qhN7EjUlQm5Mlfkd50AYfs5wuzM1t31/QCQKu0X2VFcMtnqYp27kaV 2a5x/8XuZT+Y0ILhGctg+fqhppvdL7MaPL9/cxN7Aiwm8/LomY1Eld+4wxDQLe+aYEox zgCYYDbIaJ6AANjz4WFO3+m1l6Z9+Bl1l21Su81o2RRCL0jaQzqyLUc/Luammz5H04sK Yw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tgbas92v3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 02:47:47 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 3 Oct 2023 02:47:45 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 3 Oct 2023 02:47:45 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 2CFEB3F704B; Tue, 3 Oct 2023 02:47:38 -0700 (PDT) From: To: , , , , , , , , , , , , , CC: Subject: [PATCH v6 3/3] test/event: add event link profile test Date: Tue, 3 Oct 2023 15:17:21 +0530 Message-ID: <20231003094721.5115-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231003094721.5115-1-pbhagavatula@marvell.com> References: <20231003075109.4309-1-pbhagavatula@marvell.com> <20231003094721.5115-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 6tLo_Ag4Mfb0TrhUbc3b8TlI7r2h7vCp X-Proofpoint-GUID: 6tLo_Ag4Mfb0TrhUbc3b8TlI7r2h7vCp 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_06,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,