From patchwork Fri Apr 19 09:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 139544 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 39C9E43EAC; Fri, 19 Apr 2024 11:08:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0551440273; Fri, 19 Apr 2024 11:08:21 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9209D400D6 for ; Fri, 19 Apr 2024 11:08:19 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43J6M4ua014941; Fri, 19 Apr 2024 02:08:18 -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=8pHGaQLvwh+3cx2h1cNmYg9sodbwMb28UGBAm2c7CEY=; b=ROv SoVs9uwfXcp4Alv1rHkVW3nv2gXjXNdApQQvqLQhmU4qk+XcasqQmqWxQjbFgqep oCkNDC0CKQ0WOamPrDJsDTGAr84EUlWyG+WVNzP0HnUuUOSuQf/5SDN4/0ogj2ic E5oKNZ722lnQO5peE4vwB0aJGR/dPMkvjadFtCInZWxFATkuqFmUZSSYasgkxv8F jEkB6Z0FSubmyFQV98uajBzcdHVCszACB/77ysEtXUY+TJ5NekMCi7vs5puEegpf MQxPgnA5/psqJ93j+lhfTaQWN+Rhp+wLvDX3YSjRarbKNlilA/1OmvLVdR9XZ7oJ kqRGz4OhK5M1H0c+g6g== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3xk89mtq1a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Apr 2024 02:08:17 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 19 Apr 2024 02:08:16 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 19 Apr 2024 02:08:16 -0700 Received: from localhost.localdomain (unknown [10.28.36.179]) by maili.marvell.com (Postfix) with ESMTP id 4A4653F7090; Fri, 19 Apr 2024 02:08:13 -0700 (PDT) From: Vidya Sagar Velumuri To: , , CC: , , , , , , Subject: [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Date: Fri, 19 Apr 2024 02:07:33 -0700 Message-ID: <20240419090734.43613-1-vvelumuri@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240416123747.4133884-1-vvelumuri@marvell.com> References: <20240416123747.4133884-1-vvelumuri@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: WxjtxKHlIwkzaBZEbhAUt45HSN425KYJ X-Proofpoint-ORIG-GUID: WxjtxKHlIwkzaBZEbhAUt45HSN425KYJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-19_06,2024-04-17_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 Run the sg test in a loop to verify wrap around case. Total number commands submitted to be more than the number descriptors allocated to verify the scenario. Signed-off-by: Vidya Sagar Velumuri diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 143e1bcd68..7462e90831 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -393,34 +393,26 @@ test_stop_start(int16_t dev_id, uint16_t vchan) } static int -test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan) +test_enqueue_sg(int16_t dev_id, uint16_t vchan, unsigned int n_sge, unsigned int test_len) { - unsigned int src_len, dst_len, n_sge, len, i, j, k; char orig_src[COPY_LEN], orig_dst[COPY_LEN]; - struct rte_dma_info info = { 0 }; + unsigned int src_len, dst_len, i, j, k; enum rte_dma_status_code status; uint16_t id, n_src, n_dst; - if (rte_dma_info_get(dev_id, &info) < 0) - ERR_RETURN("Failed to get dev info"); - - if (info.max_sges < 2) - ERR_RETURN("Test needs minimum 2 SG pointers"); - - n_sge = info.max_sges; - for (n_src = 1; n_src <= n_sge; n_src++) { for (n_dst = 1; n_dst <= n_sge; n_dst++) { /* Normalize SG buffer lengths */ - len = COPY_LEN; - len -= (len % (n_src * n_dst)); - dst_len = len / n_dst; - src_len = len / n_src; - + unsigned int len = test_len - (test_len % (n_src * n_dst)); struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge]; struct rte_mbuf *src[n_sge], *dst[n_sge]; char *src_data[n_sge], *dst_data[n_sge]; + dst_len = len / n_dst; + src_len = len / n_src; + if (dst_len == 0 || src_len == 0) + continue; + for (i = 0 ; i < len; i++) orig_src[i] = rte_rand() & 0xFF; @@ -511,6 +503,27 @@ test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan) return 0; } +static int +test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan) +{ + struct rte_dma_info info = { 0 }; + unsigned int n_sge, len; + int loop_count = 0; + + if (rte_dma_info_get(dev_id, &info) < 0) + ERR_RETURN("Failed to get dev info"); + + n_sge = RTE_MIN(info.max_sges, TEST_SG_MAX); + len = COPY_LEN; + + do { + test_enqueue_sg(dev_id, vchan, n_sge, len); + loop_count++; + } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3); + + return 0; +} + /* Failure handling test cases - global macros and variables for those tests*/ #define COMP_BURST_SZ 16 #define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0) diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c index d40c05cfbf..6a07ed593b 100644 --- a/app/test/test_dmadev_api.c +++ b/app/test/test_dmadev_api.c @@ -16,7 +16,6 @@ extern int test_dma_api(uint16_t dev_id); #define TEST_MEMCPY_SIZE 1024 #define TEST_WAIT_US_VAL 50000 -#define TEST_SG_MAX 64 static int16_t test_dev_id; static int16_t invalid_dev_id; diff --git a/app/test/test_dmadev_api.h b/app/test/test_dmadev_api.h index 33fbc5bd41..a03f7acd4f 100644 --- a/app/test/test_dmadev_api.h +++ b/app/test/test_dmadev_api.h @@ -2,4 +2,6 @@ * Copyright(c) 2021 HiSilicon Limited */ +#define TEST_SG_MAX 64 + int test_dma_api(uint16_t dev_id); From patchwork Fri Apr 19 09:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 139545 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 628C343EAC; Fri, 19 Apr 2024 11:08:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D973402DF; Fri, 19 Apr 2024 11:08:46 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A8B5A400D6 for ; Fri, 19 Apr 2024 11:08:44 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43ILYmnV010585; Fri, 19 Apr 2024 02:08:42 -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=YvEEhxG/F+51MlXyiC9SUEGEYNg7nMXqBbPiBNUyQT0=; b=WXR /HSPkjCGbhlQZjpNRYtCZWmV2yc67997feG2inI1soHmeAwhVJ7ReZWiQS59j2Tt ToCW+maZKMhXUay4IxTkx5JJOubrZwL8Gv4aQrU0r7Vh8lm0ATYLXEcPjvBj3LS7 6N//MoregAGolcxpR1pQqORw1qXNWsQOd8syMCwhvMcWkqe1I1ozhVpWxOC5dP3f DQXVOPrNvPrKwh5HPbsA9hEKghck0saDWZ6UWfUpnDCHnl4pU33YtNoRVWba8yWl jsk0MA0ju3RaOuoqLTjdWbbQOdvZ6tVoGrusVzb+lfq7zMA6G17eH8ScT4Ol7K0I 9EWKz+ARF392+NPN6HQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3xjhecqmpb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Apr 2024 02:08:42 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 19 Apr 2024 02:08:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 19 Apr 2024 02:08:41 -0700 Received: from localhost.localdomain (unknown [10.28.36.179]) by maili.marvell.com (Postfix) with ESMTP id 11EFC3F7091; Fri, 19 Apr 2024 02:08:37 -0700 (PDT) From: Vidya Sagar Velumuri To: , , CC: , , , , , , Subject: [PATCH v2 2/2] test/dma: add functions to verify zero and one fill Date: Fri, 19 Apr 2024 02:07:34 -0700 Message-ID: <20240419090734.43613-2-vvelumuri@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240419090734.43613-1-vvelumuri@marvell.com> References: <20240416123747.4133884-1-vvelumuri@marvell.com> <20240419090734.43613-1-vvelumuri@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: MyS0E_qn-UJCCY94-uIIDOXP-ucdusMX X-Proofpoint-GUID: MyS0E_qn-UJCCY94-uIIDOXP-ucdusMX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-19_06,2024-04-17_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 Add test cases to verify zero fill and one fill Signed-off-by: Vidya Sagar Velumuri diff --git a/app/test/test.h b/app/test/test.h index 15e23d297f..0ca6519f6e 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -27,6 +27,10 @@ #include +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + #define TEST_ASSERT RTE_TEST_ASSERT #define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 7462e90831..ec896a4905 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -869,42 +869,51 @@ test_completion_handling(int16_t dev_id, uint16_t vchan) static int test_enqueue_fill(int16_t dev_id, uint16_t vchan) { + uint64_t pattern[3] = {0x0, 0xfedcba9876543210, 0xffffffffffffffff}; const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89}; + unsigned int i, j, k; struct rte_mbuf *dst; char *dst_data; - uint64_t pattern = 0xfedcba9876543210; - unsigned int i, j; dst = rte_pktmbuf_alloc(pool); if (dst == NULL) ERR_RETURN("Failed to allocate mbuf\n"); dst_data = rte_pktmbuf_mtod(dst, char *); - for (i = 0; i < RTE_DIM(lengths); i++) { - /* reset dst_data */ - memset(dst_data, 0, rte_pktmbuf_data_len(dst)); + for (k = 0; k < ARRAY_SIZE(pattern); k++) { + for (i = 0; i < RTE_DIM(lengths); i++) { + /* reset dst_data */ + memset(dst_data, 0, rte_pktmbuf_data_len(dst)); + + /* perform the fill operation */ + int id = rte_dma_fill(dev_id, vchan, pattern[k], + rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT); + if (id < 0) { + if (id == -ENOTSUP) { + rte_pktmbuf_free(dst); + break; + } + ERR_RETURN("Error with rte_dma_fill\n"); + } + await_hw(dev_id, vchan); - /* perform the fill operation */ - int id = rte_dma_fill(dev_id, vchan, pattern, - rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT); - if (id < 0) - ERR_RETURN("Error with rte_dma_fill\n"); - await_hw(dev_id, vchan); + if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) != 1) + ERR_RETURN("Error: fill operation failed (length: %u)\n", + lengths[i]); + /* check the data from the fill operation is correct */ + for (j = 0; j < lengths[i]; j++) { + char pat_byte = ((char *)&pattern[k])[j % 8]; - if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) != 1) - ERR_RETURN("Error: fill operation failed (length: %u)\n", lengths[i]); - /* check the data from the fill operation is correct */ - for (j = 0; j < lengths[i]; j++) { - char pat_byte = ((char *)&pattern)[j % 8]; - if (dst_data[j] != pat_byte) - ERR_RETURN("Error with fill operation (lengths = %u): got (%x), not (%x)\n", - lengths[i], dst_data[j], pat_byte); + if (dst_data[j] != pat_byte) + ERR_RETURN("Error with fill operation (lengths = %u): got (%x), not (%x)\n", + lengths[i], dst_data[j], pat_byte); + } + /* check that the data after the fill operation was not written to */ + for (; j < rte_pktmbuf_data_len(dst); j++) + if (dst_data[j] != 0) + ERR_RETURN("Error, fill operation wrote too far (lengths = %u): got (%x), not (%x)\n", + lengths[i], dst_data[j], 0); } - /* check that the data after the fill operation was not written to */ - for (; j < rte_pktmbuf_data_len(dst); j++) - if (dst_data[j] != 0) - ERR_RETURN("Error, fill operation wrote too far (lengths = %u): got (%x), not (%x)\n", - lengths[i], dst_data[j], 0); } rte_pktmbuf_free(dst);