From patchwork Fri Nov 3 15:38:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gowrishankar Muthukrishnan X-Patchwork-Id: 133840 X-Patchwork-Delegate: thomas@monjalon.net 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 576904327C; Fri, 3 Nov 2023 16:38:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DCE542DD1; Fri, 3 Nov 2023 16:38:20 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5DC0A42DD0 for ; Fri, 3 Nov 2023 16:38:18 +0100 (CET) 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 3A3BVgd8010488; Fri, 3 Nov 2023 08:38:17 -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=l/G7aoRIJigsPMo2B0IRROZZDkCNsjri+tXp1lPNPaQ=; b=SgoeTxkL+hxiLIMsFLsXD4H5w3zCdCipyMIeMPDhG6ElStQSKuSvYMxAJhTx89Wb7HRw HXGKsnEHAMEv/Hgy5fHhfJNqp3KfyrGhO69UTIXj8BhckWG55dvOLHiummV+aGErR4f1 h6Nm3RzmZk9dHZuAM1AOmKYFW6VtO5W9dvY12lLUbm8YLaY+B+hzLhCHzd3ZTdmtHn4n TC9N2QcojAdH7wIl48AbVcpNppOejXY6uxB82oa9OUx2iibumq/nR9ICpH+Aiv17ynLX p5MAkjQWBY1XEV51rdnUHt9EPvQvKTJefXiGKLw1R24+ulEz+Up4RZS/8qLF1S7qkoKO dQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3u4m34awnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 03 Nov 2023 08:38:17 -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; Fri, 3 Nov 2023 08:38:15 -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; Fri, 3 Nov 2023 08:38:15 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id B72973F70B2; Fri, 3 Nov 2023 08:38:12 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , Chengwen Feng , "Vamsi Attunuru" , Amit Prakash Shukla , Vidya Sagar Velumuri , Kevin Laatz , Bruce Richardson , Gowrishankar Muthukrishnan Subject: [PATCH v3 2/3] test/dma: test vchan reconfiguration Date: Fri, 3 Nov 2023 21:08:02 +0530 Message-ID: <2c7f6c7b3bec94325c6b96afbd8e9388a1c14a9d.1699025423.git.gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: pjTMpEiNhHm-0tff5M4lirPaTY0x8_Mz X-Proofpoint-GUID: pjTMpEiNhHm-0tff5M4lirPaTY0x8_Mz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-03_15,2023-11-02_03,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 Reconfigure vchan count and validate if new count is effective. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_dmadev_api.c | 63 +++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c index da8fddb3ca..aa07d2b359 100644 --- a/app/test/test_dmadev_api.c +++ b/app/test/test_dmadev_api.c @@ -260,7 +260,7 @@ test_dma_vchan_setup(void) } static int -setup_one_vchan(void) +setup_vchan(int nb_vchans) { struct rte_dma_vchan_conf vchan_conf = { 0 }; struct rte_dma_info dev_info = { 0 }; @@ -269,13 +269,15 @@ setup_one_vchan(void) ret = rte_dma_info_get(test_dev_id, &dev_info); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); - dev_conf.nb_vchans = 1; + dev_conf.nb_vchans = nb_vchans; ret = rte_dma_configure(test_dev_id, &dev_conf); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure, %d", ret); vchan_conf.direction = RTE_DMA_DIR_MEM_TO_MEM; vchan_conf.nb_desc = dev_info.min_desc; - ret = rte_dma_vchan_setup(test_dev_id, 0, &vchan_conf); - RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup vchan, %d", ret); + for (int i = 0; i < nb_vchans; i++) { + ret = rte_dma_vchan_setup(test_dev_id, i, &vchan_conf); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup vchan %d, %d", i, ret); + } return TEST_SUCCESS; } @@ -294,7 +296,7 @@ test_dma_start_stop(void) RTE_TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -312,6 +314,50 @@ test_dma_start_stop(void) return TEST_SUCCESS; } +static int +test_dma_reconfigure(void) +{ + struct rte_dma_conf dev_conf = { 0 }; + struct rte_dma_info dev_info = { 0 }; + uint16_t cfg_vchans; + int ret; + + ret = rte_dma_info_get(test_dev_id, &dev_info); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); + + /* At least two vchans required for the test */ + if (dev_info.max_vchans < 2) + return TEST_SKIPPED; + + /* Setup one vchan for later test */ + ret = setup_vchan(1); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); + + ret = rte_dma_start(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start, %d", ret); + + ret = rte_dma_stop(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to stop, %d", ret); + + /* Check reconfigure and vchan setup after device stopped */ + cfg_vchans = dev_conf.nb_vchans = (dev_info.max_vchans - 1); + + ret = setup_vchan(cfg_vchans); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); + + ret = rte_dma_start(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start, %d", ret); + + ret = rte_dma_info_get(test_dev_id, &dev_info); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); + RTE_TEST_ASSERT_EQUAL(dev_info.nb_vchans, cfg_vchans, "incorrect reconfiguration"); + + ret = rte_dma_stop(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to stop, %d", ret); + + return TEST_SUCCESS; +} + static int test_dma_stats(void) { @@ -328,7 +374,7 @@ test_dma_stats(void) RTE_TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); /* Check for invalid vchan */ @@ -400,7 +446,7 @@ test_dma_completed(void) int ret; /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -459,7 +505,7 @@ test_dma_completed_status(void) int ret; /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -517,6 +563,7 @@ static struct unit_test_suite dma_api_testsuite = { TEST_CASE(test_dma_configure), TEST_CASE(test_dma_vchan_setup), TEST_CASE(test_dma_start_stop), + TEST_CASE(test_dma_reconfigure), TEST_CASE(test_dma_stats), TEST_CASE(test_dma_dump), TEST_CASE(test_dma_completed),