get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/134422/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 134422,
    "url": "https://patches.dpdk.org/api/patches/134422/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231116105917.2060-4-gmuthukrishn@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231116105917.2060-4-gmuthukrishn@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231116105917.2060-4-gmuthukrishn@marvell.com",
    "date": "2023-11-16T10:59:17",
    "name": "[v6,3/3] test/dma: add SG copy tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5e01300dd1b3f40c17b8a251d53221364b9215de",
    "submitter": {
        "id": 2301,
        "url": "https://patches.dpdk.org/api/people/2301/?format=api",
        "name": "Gowrishankar Muthukrishnan",
        "email": "gmuthukrishn@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20231116105917.2060-4-gmuthukrishn@marvell.com/mbox/",
    "series": [
        {
            "id": 30315,
            "url": "https://patches.dpdk.org/api/series/30315/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=30315",
            "date": "2023-11-16T10:59:14",
            "name": "test/dma: add vchan reconfig and SG tests",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/30315/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/134422/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/134422/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 28DE043343;\n\tThu, 16 Nov 2023 11:59:55 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7C4D94067E;\n\tThu, 16 Nov 2023 11:59:44 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id E07BC402DD\n for <dev@dpdk.org>; Thu, 16 Nov 2023 11:59:39 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 3AG9AvZ9007353; Thu, 16 Nov 2023 02:59:39 -0800",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uc5vmu95w-4\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Thu, 16 Nov 2023 02:59:39 -0800",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Thu, 16 Nov 2023 02:59:35 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Thu, 16 Nov 2023 02:59:35 -0800",
            "from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34])\n by maili.marvell.com (Postfix) with ESMTP id 06BD33F7086;\n Thu, 16 Nov 2023 02:59:31 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=GwrSr2VNWdelMNSGUvRKUH5uf7Vk+bEGZKIE26XPbSQ=;\n b=P61HUL6K4cfuEvgIqyBjYhwbhkHqh7116LVtnq+vQWjUWxCbcgCqnsCj2veg6n2x+s+c\n nzYckXSsAbCtqDHPDEInEkm5+qnFP+gDjU6QFIblTax3ZjHKsfV0s2rYDvW/rkxRLxwk\n 8bM5Ap+WZPWmiQ3dZURjFhZVV5a7snZg8uzrvzFZmzM59GACpowScJ+q/Ald1pmBY94p\n d4qxfn+3i1227mATwBhnYw+1GrOTGPWPUVhfBlXktAeeEq3qV7ewULiqRUFMx9I1eGVl\n S2ysGBxTmqUOIF9lsFeCaBwgDSWySiTe4aAuz3VlGAst+HjHM2Fh1d9QvW2SVclUeISx WA==",
        "From": "Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<anoobj@marvell.com>, Chengwen Feng <fengchengwen@huawei.com>, \"Vamsi\n Attunuru\" <vattunuru@marvell.com>, Amit Prakash Shukla\n <amitprakashs@marvell.com>, Vidya Sagar Velumuri <vvelumuri@marvell.com>,\n Kevin Laatz <kevin.laatz@intel.com>, Bruce Richardson\n <bruce.richardson@intel.com>, Gowrishankar Muthukrishnan\n <gmuthukrishn@marvell.com>",
        "Subject": "[PATCH v6 3/3] test/dma: add SG copy tests",
        "Date": "Thu, 16 Nov 2023 16:29:17 +0530",
        "Message-ID": "<20231116105917.2060-4-gmuthukrishn@marvell.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20231116105917.2060-1-gmuthukrishn@marvell.com>",
        "References": "<20231116104012.1985-1-gmuthukrishn@marvell.com>\n <20231116105917.2060-1-gmuthukrishn@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "eEqI_6FK4GHf1uD91LHYfQiIBHncfJU0",
        "X-Proofpoint-GUID": "eEqI_6FK4GHf1uD91LHYfQiIBHncfJU0",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-11-16_09,2023-11-16_01,2023-05-22_02",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Add scatter-gather copy tests.\n\nSigned-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>\nSigned-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n app/test/test_dmadev.c     | 139 ++++++++++++++++++++++++++++++-\n app/test/test_dmadev_api.c | 164 ++++++++++++++++++++++++++++++++++---\n 2 files changed, 289 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c\nindex f4a40190e5..d426ea0a85 100644\n--- a/app/test/test_dmadev.c\n+++ b/app/test/test_dmadev.c\n@@ -19,7 +19,7 @@\n #define ERR_RETURN(...) do { print_err(__func__, __LINE__, __VA_ARGS__); return -1; } while (0)\n \n #define TEST_RINGSIZE 512\n-#define COPY_LEN 1024\n+#define COPY_LEN 2048\n \n static struct rte_dma_info info;\n static struct rte_mempool *pool;\n@@ -391,6 +391,125 @@ test_stop_start(int16_t dev_id, uint16_t vchan)\n \treturn 0;\n }\n \n+static int\n+test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan)\n+{\n+\tunsigned int src_len, dst_len, n_sge, len, i, j, k;\n+\tchar orig_src[COPY_LEN], orig_dst[COPY_LEN];\n+\tstruct rte_dma_info info = { 0 };\n+\tenum rte_dma_status_code status;\n+\tuint16_t id, n_src, n_dst;\n+\n+\tif (rte_dma_info_get(dev_id, &info) < 0)\n+\t\tERR_RETURN(\"Failed to get dev info\");\n+\n+\tif (info.max_sges < 2)\n+\t\tERR_RETURN(\"Test needs minimum 2 SG pointers\");\n+\n+\tn_sge = info.max_sges;\n+\n+\tfor (n_src = 1; n_src <= n_sge; n_src++) {\n+\t\tfor (n_dst = 1; n_dst <= n_sge; n_dst++) {\n+\t\t\t/* Normalize SG buffer lengths */\n+\t\t\tlen = COPY_LEN;\n+\t\t\tlen -= (len % (n_src * n_dst));\n+\t\t\tdst_len = len / n_dst;\n+\t\t\tsrc_len = len / n_src;\n+\n+\t\t\tstruct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];\n+\t\t\tstruct rte_mbuf *src[n_sge], *dst[n_sge];\n+\t\t\tchar *src_data[n_sge], *dst_data[n_sge];\n+\n+\t\t\tfor (i = 0 ; i < len; i++)\n+\t\t\t\torig_src[i] = rte_rand() & 0xFF;\n+\n+\t\t\tmemset(orig_dst, 0, len);\n+\n+\t\t\tfor (i = 0; i < n_src; i++) {\n+\t\t\t\tsrc[i] = rte_pktmbuf_alloc(pool);\n+\t\t\t\tRTE_ASSERT(src[i] != NULL);\n+\t\t\t\tsg_src[i].addr = rte_pktmbuf_iova(src[i]);\n+\t\t\t\tsg_src[i].length = src_len;\n+\t\t\t\tsrc_data[i] = rte_pktmbuf_mtod(src[i], char *);\n+\t\t\t}\n+\n+\t\t\tfor (k = 0; k < n_dst; k++) {\n+\t\t\t\tdst[k] = rte_pktmbuf_alloc(pool);\n+\t\t\t\tRTE_ASSERT(dst[k] != NULL);\n+\t\t\t\tsg_dst[k].addr = rte_pktmbuf_iova(dst[k]);\n+\t\t\t\tsg_dst[k].length = dst_len;\n+\t\t\t\tdst_data[k] = rte_pktmbuf_mtod(dst[k], char *);\n+\t\t\t}\n+\n+\t\t\tfor (i = 0; i < n_src; i++) {\n+\t\t\t\tfor (j = 0; j < src_len; j++)\n+\t\t\t\t\tsrc_data[i][j] = orig_src[i * src_len + j];\n+\t\t\t}\n+\n+\t\t\tfor (k = 0; k < n_dst; k++)\n+\t\t\t\tmemset(dst_data[k], 0, dst_len);\n+\n+\t\t\tprintf(\"\\tsrc segs: %2d [seg len: %4d] - dst segs: %2d [seg len : %4d]\\n\",\n+\t\t\t\tn_src, src_len, n_dst, dst_len);\n+\n+\t\t\tid = rte_dma_copy_sg(dev_id, vchan, sg_src, sg_dst, n_src, n_dst,\n+\t\t\t\t\t     RTE_DMA_OP_FLAG_SUBMIT);\n+\n+\t\t\tif (id != id_count)\n+\t\t\t\tERR_RETURN(\"Error with rte_dma_copy_sg, got %u, expected %u\\n\",\n+\t\t\t\t\tid, id_count);\n+\n+\t\t\t/* Give time for copy to finish, then check it was done */\n+\t\t\tawait_hw(dev_id, vchan);\n+\n+\t\t\tfor (k = 0; k < n_dst; k++)\n+\t\t\t\tmemcpy((&orig_dst[0] + k * dst_len), dst_data[k], dst_len);\n+\n+\t\t\tif (memcmp(orig_src, orig_dst, COPY_LEN))\n+\t\t\t\tERR_RETURN(\"Data mismatch\");\n+\n+\t\t\t/* Verify completion */\n+\t\t\tid = ~id;\n+\t\t\tif (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 1)\n+\t\t\t\tERR_RETURN(\"Error with rte_dma_completed\\n\");\n+\n+\t\t\t/* Verify expected index(id_count) */\n+\t\t\tif (id != id_count)\n+\t\t\t\tERR_RETURN(\"Error:incorrect job id received, %u [expected %u]\\n\",\n+\t\t\t\t\t\tid, id_count);\n+\n+\t\t\t/* Check for completed and id when no job done */\n+\t\t\tid = ~id;\n+\t\t\tif (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0)\n+\t\t\t\tERR_RETURN(\"Error with rte_dma_completed when no job done\\n\");\n+\n+\t\t\tif (id != id_count)\n+\t\t\t\tERR_RETURN(\"Error:incorrect job id received when no job done, %u [expected %u]\\n\",\n+\t\t\t\t\t   id, id_count);\n+\n+\t\t\t/* Check for completed_status and id when no job done */\n+\t\t\tid = ~id;\n+\t\t\tif (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0)\n+\t\t\t\tERR_RETURN(\"Error with rte_dma_completed_status when no job done\\n\");\n+\t\t\tif (id != id_count)\n+\t\t\t\tERR_RETURN(\"Error:incorrect job id received when no job done, %u [expected %u]\\n\",\n+\t\t\t\t\t\tid, 0);\n+\n+\t\t\tfor (i = 0; i < n_src; i++)\n+\t\t\t\trte_pktmbuf_free(src[i]);\n+\t\t\tfor (i = 0; i < n_dst; i++)\n+\t\t\t\trte_pktmbuf_free(dst[i]);\n+\n+\t\t\t/* Verify that completion returns nothing more */\n+\t\t\tif (rte_dma_completed(dev_id, 0, 1, NULL, NULL) != 0)\n+\t\t\t\tERR_RETURN(\"Error with rte_dma_completed in empty check\\n\");\n+\n+\t\t\tid_count++;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n /* Failure handling test cases - global macros and variables for those tests*/\n #define COMP_BURST_SZ\t16\n #define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)\n@@ -929,6 +1048,17 @@ prepare_m2d_auto_free(int16_t dev_id, uint16_t vchan)\n \treturn 0;\n }\n \n+static int\n+test_dmadev_sg_copy_setup(void)\n+{\n+\tint ret = TEST_SUCCESS;\n+\n+\tif ((info.dev_capa & RTE_DMA_CAPA_OPS_COPY_SG) == 0)\n+\t\treturn TEST_SKIPPED;\n+\n+\treturn ret;\n+}\n+\n static int\n test_dmadev_burst_setup(void)\n {\n@@ -1044,7 +1174,7 @@ test_dmadev_setup(void)\n \t\t\tTEST_RINGSIZE * 2, /* n == num elements */\n \t\t\t32,  /* cache size */\n \t\t\t0,   /* priv size */\n-\t\t\t2048, /* data room size */\n+\t\t\tCOPY_LEN + RTE_PKTMBUF_HEADROOM, /* data room size */\n \t\t\tinfo.numa_node);\n \tif (pool == NULL)\n \t\tERR_RETURN(\"Error with mempool creation\\n\");\n@@ -1070,6 +1200,7 @@ test_dmadev_instance(int16_t dev_id)\n \tstruct rte_dma_info dev_info;\n \tenum {\n \t\t  TEST_COPY = 0,\n+\t\t  TEST_COPY_SG,\n \t\t  TEST_START,\n \t\t  TEST_BURST,\n \t\t  TEST_ERR,\n@@ -1080,6 +1211,7 @@ test_dmadev_instance(int16_t dev_id)\n \n \tstatic struct runtest_param param[] = {\n \t\t{\"copy\", test_enqueue_copies, 640},\n+\t\t{\"sg_copy\", test_enqueue_sg_copies, 1},\n \t\t{\"stop_start\", test_stop_start, 1},\n \t\t{\"burst_capacity\", test_burst_capacity, 1},\n \t\t{\"error_handling\", test_completion_handling, 1},\n@@ -1095,6 +1227,9 @@ test_dmadev_instance(int16_t dev_id)\n \t\t\tTEST_CASE_NAMED_WITH_DATA(param[TEST_COPY].name,\n \t\t\t\tNULL, NULL,\n \t\t\t\truntest, &param[TEST_COPY]),\n+\t\t\tTEST_CASE_NAMED_WITH_DATA(param[TEST_COPY_SG].name,\n+\t\t\t\ttest_dmadev_sg_copy_setup, NULL,\n+\t\t\t\truntest, &param[TEST_COPY_SG]),\n \t\t\tTEST_CASE_NAMED_WITH_DATA(param[TEST_START].name,\n \t\t\t\tNULL, NULL,\n \t\t\t\truntest, &param[TEST_START]),\ndiff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c\nindex 2b8a4eda62..a130e74b51 100644\n--- a/app/test/test_dmadev_api.c\n+++ b/app/test/test_dmadev_api.c\n@@ -10,47 +10,75 @@\n #include <rte_dmadev.h>\n \n #include \"test.h\"\n+#include \"test_dmadev_api.h\"\n \n extern int test_dma_api(uint16_t dev_id);\n \n #define TEST_MEMCPY_SIZE\t1024\n #define TEST_WAIT_US_VAL\t50000\n+#define TEST_SG_MAX\t\t64\n \n static int16_t test_dev_id;\n static int16_t invalid_dev_id;\n \n static char *src;\n static char *dst;\n+static char *src_sg[TEST_SG_MAX];\n+static char *dst_sg[TEST_SG_MAX];\n \n static int\n testsuite_setup(void)\n {\n \tinvalid_dev_id = -1;\n-\n-\tsrc = rte_malloc(\"dmadev_test_src\", TEST_MEMCPY_SIZE, 0);\n-\tif (src == NULL)\n-\t\treturn -ENOMEM;\n-\tdst = rte_malloc(\"dmadev_test_dst\", TEST_MEMCPY_SIZE, 0);\n-\tif (dst == NULL) {\n-\t\trte_free(src);\n-\t\tsrc = NULL;\n-\t\treturn -ENOMEM;\n+\tint i, rc = 0;\n+\n+\tfor (i = 0; i < TEST_SG_MAX; i++) {\n+\t\tsrc_sg[i] = rte_malloc(\"dmadev_test_src\", TEST_MEMCPY_SIZE, 0);\n+\t\tif (src_sg[i] == NULL) {\n+\t\t\trc = -ENOMEM;\n+\t\t\tgoto exit;\n+\t\t}\n+\n+\t\tdst_sg[i] = rte_malloc(\"dmadev_test_dst\", TEST_MEMCPY_SIZE, 0);\n+\t\tif (dst_sg[i] == NULL) {\n+\t\t\trte_free(src_sg[i]);\n+\t\t\tsrc_sg[i] = NULL;\n+\t\t\trc = -ENOMEM;\n+\t\t\tgoto exit;\n+\t\t}\n \t}\n \n+\tsrc = src_sg[0];\n+\tdst = dst_sg[0];\n+\n \t/* Set dmadev log level to critical to suppress unnecessary output\n \t * during API tests.\n \t */\n \trte_log_set_level_pattern(\"lib.dmadev\", RTE_LOG_CRIT);\n \n-\treturn 0;\n+\treturn rc;\n+exit:\n+\twhile (--i >= 0) {\n+\t\trte_free(src_sg[i]);\n+\t\trte_free(dst_sg[i]);\n+\t}\n+\n+\treturn rc;\n }\n \n static void\n testsuite_teardown(void)\n {\n-\trte_free(src);\n+\tint i;\n+\n+\tfor (i = 0; i < TEST_SG_MAX; i++) {\n+\t\trte_free(src_sg[i]);\n+\t\tsrc_sg[i] = NULL;\n+\t\trte_free(dst_sg[i]);\n+\t\tdst_sg[i] = NULL;\n+\t}\n+\n \tsrc = NULL;\n-\trte_free(dst);\n \tdst = NULL;\n \t/* Ensure the dmadev is stopped. */\n \trte_dma_stop(test_dev_id);\n@@ -437,6 +465,37 @@ verify_memory(void)\n \treturn 0;\n }\n \n+static void\n+sg_memory_setup(int n)\n+{\n+\tint i, j;\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\tfor (j = 0; j < TEST_MEMCPY_SIZE; j++)\n+\t\t\tsrc_sg[i][j] = (char)j;\n+\n+\t\tmemset(dst_sg[i], 0, TEST_MEMCPY_SIZE);\n+\t}\n+}\n+\n+static int\n+sg_memory_verify(int n)\n+{\n+\tint i, j;\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\tfor (j = 0; j < TEST_MEMCPY_SIZE; j++) {\n+\t\t\tif (src_sg[i][j] == dst_sg[i][j])\n+\t\t\t\tcontinue;\n+\n+\t\t\tRTE_TEST_ASSERT_EQUAL(src_sg[i][j], dst_sg[i][j], \"Failed to copy memory, %d %d\",\n+\t\t\t\tsrc_sg[i][j], dst_sg[i][j]);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n test_dma_completed(void)\n {\n@@ -551,6 +610,86 @@ test_dma_completed_status(void)\n \treturn TEST_SUCCESS;\n }\n \n+static int\n+test_dma_sg(void)\n+{\n+\tstruct rte_dma_sge src_sge[TEST_SG_MAX], dst_sge[TEST_SG_MAX];\n+\tstruct rte_dma_info dev_info = { 0 };\n+\tuint16_t last_idx = -1;\n+\tbool has_error = true;\n+\tint n_sge, i, ret;\n+\tuint16_t cpl_ret;\n+\n+\tret = rte_dma_info_get(test_dev_id, &dev_info);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to obtain device info, %d\", ret);\n+\n+\tif ((dev_info.dev_capa & RTE_DMA_CAPA_OPS_COPY_SG) == 0)\n+\t\treturn TEST_SKIPPED;\n+\n+\tn_sge = RTE_MIN(dev_info.max_sges, TEST_SG_MAX);\n+\n+\tret = setup_vchan(1);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to setup one vchan, %d\", ret);\n+\n+\tret = rte_dma_start(test_dev_id);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to start, %d\", ret);\n+\n+\tfor (i = 0; i < n_sge; i++) {\n+\t\tsrc_sge[i].addr = rte_malloc_virt2iova(src_sg[i]);\n+\t\tsrc_sge[i].length = TEST_MEMCPY_SIZE;\n+\t\tdst_sge[i].addr = rte_malloc_virt2iova(dst_sg[i]);\n+\t\tdst_sge[i].length = TEST_MEMCPY_SIZE;\n+\t}\n+\n+\tsg_memory_setup(n_sge);\n+\n+\t/* Check enqueue without submit */\n+\tret = rte_dma_copy_sg(test_dev_id, 0, src_sge, dst_sge, n_sge, n_sge, 0);\n+\tRTE_TEST_ASSERT_EQUAL(ret, 0, \"Failed to enqueue copy, %d\", ret);\n+\n+\trte_delay_us_sleep(TEST_WAIT_US_VAL);\n+\n+\tcpl_ret = rte_dma_completed(test_dev_id, 0, 1, &last_idx, &has_error);\n+\tRTE_TEST_ASSERT_EQUAL(cpl_ret, 0, \"Failed to get completed\");\n+\n+\t/* Check DMA submit */\n+\tret = rte_dma_submit(test_dev_id, 0);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to submit, %d\", ret);\n+\n+\trte_delay_us_sleep(TEST_WAIT_US_VAL);\n+\n+\tcpl_ret = rte_dma_completed(test_dev_id, 0, 1, &last_idx, &has_error);\n+\tRTE_TEST_ASSERT_EQUAL(cpl_ret, 1, \"Failed to get completed\");\n+\tRTE_TEST_ASSERT_EQUAL(last_idx, 0, \"Last idx should be zero, %u\", last_idx);\n+\tRTE_TEST_ASSERT_EQUAL(has_error, false, \"Should have no error\");\n+\n+\tret = sg_memory_verify(n_sge);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to verify memory\");\n+\n+\tsg_memory_setup(n_sge);\n+\n+\t/* Check for enqueue with submit */\n+\tret = rte_dma_copy_sg(test_dev_id, 0, src_sge, dst_sge, n_sge, n_sge,\n+\t\t\t      RTE_DMA_OP_FLAG_SUBMIT);\n+\tRTE_TEST_ASSERT_EQUAL(ret, 1, \"Failed to enqueue copy, %d\", ret);\n+\n+\trte_delay_us_sleep(TEST_WAIT_US_VAL);\n+\n+\tcpl_ret = rte_dma_completed(test_dev_id, 0, 1, &last_idx, &has_error);\n+\tRTE_TEST_ASSERT_EQUAL(cpl_ret, 1, \"Failed to get completed\");\n+\tRTE_TEST_ASSERT_EQUAL(last_idx, 1, \"Last idx should be 1, %u\", last_idx);\n+\tRTE_TEST_ASSERT_EQUAL(has_error, false, \"Should have no error\");\n+\n+\tret = sg_memory_verify(n_sge);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to verify memory\");\n+\n+\t/* Stop dmadev to make sure dmadev to a known state */\n+\tret = rte_dma_stop(test_dev_id);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to stop, %d\", ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n static struct unit_test_suite dma_api_testsuite = {\n \t.suite_name = \"DMA API Test Suite\",\n \t.setup = testsuite_setup,\n@@ -568,6 +707,7 @@ static struct unit_test_suite dma_api_testsuite = {\n \t\tTEST_CASE(test_dma_dump),\n \t\tTEST_CASE(test_dma_completed),\n \t\tTEST_CASE(test_dma_completed_status),\n+\t\tTEST_CASE(test_dma_sg),\n \t\tTEST_CASES_END()\n \t}\n };\n",
    "prefixes": [
        "v6",
        "3/3"
    ]
}