Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/132423/?format=api
https://patches.dpdk.org/api/patches/132423/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231009120236.1641008-3-amitprakashs@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": "<20231009120236.1641008-3-amitprakashs@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231009120236.1641008-3-amitprakashs@marvell.com", "date": "2023-10-09T12:02:36", "name": "[v4,2/2] test/dma: auto free offload test to free DMA buffer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "19bb119b97c02174793d814eda0a6b55fee65634", "submitter": { "id": 2699, "url": "https://patches.dpdk.org/api/people/2699/?format=api", "name": "Amit Prakash Shukla", "email": "amitprakashs@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/20231009120236.1641008-3-amitprakashs@marvell.com/mbox/", "series": [ { "id": 29770, "url": "https://patches.dpdk.org/api/series/29770/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29770", "date": "2023-10-09T12:02:34", "name": "offload support to auto free dma buffer", "version": 4, "mbox": "https://patches.dpdk.org/series/29770/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/132423/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/132423/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 D222C4233C;\n\tMon, 9 Oct 2023 14:03:16 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id BFE5D40689;\n\tMon, 9 Oct 2023 14:03:16 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 810D64026B\n for <dev@dpdk.org>; Mon, 9 Oct 2023 14:03:15 +0200 (CEST)", "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 399Bvni2019293; Mon, 9 Oct 2023 05:03:14 -0700", "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tkh9sm36p-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 09 Oct 2023 05:03:14 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Mon, 9 Oct 2023 05:03:12 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Mon, 9 Oct 2023 05:03:12 -0700", "from localhost.localdomain (unknown [10.28.36.157])\n by maili.marvell.com (Postfix) with ESMTP id 02D0B3F70AF;\n Mon, 9 Oct 2023 05:03:07 -0700 (PDT)" ], "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=OuihhCm5Su8F5V7Nrs/35Dd01hm6gVeQvqfRsPJttco=;\n b=P155wV1AulbmZhML2SjOqEY/2Mfyj/D2Vbl7qa0Z9XP1CeKqM3GmoOIt3DZwWMkb/fSw\n AXHfsI+PmaUnL0tT/RWl3g68yVkyhmJ0e4dT7ne3ZMSoiRJXZjnYuApldiMQrbGg9l6V\n /SQYdIztE1a89oxHk4ECXj0dK9iHXIdXes126zVrp1Ll2F/QKMzJyg1Bgm6v4P94bgBd\n ovVw69EpfQLKqZx/j62Kxqgw8WpXyVEK6rBns9CIA4RHf9e02gLSkQ9atj+JxjOCOhGC\n SPsVcKl3CjBT8n+O9+r3QQgLI/55q7r3nFFS/5xdgByjz1garK2LKb5b9UjJQni59oWB LQ==", "From": "Amit Prakash Shukla <amitprakashs@marvell.com>", "To": "Chengwen Feng <fengchengwen@huawei.com>, Kevin Laatz\n <kevin.laatz@intel.com>, Bruce Richardson <bruce.richardson@intel.com>", "CC": "<dev@dpdk.org>, <jerinj@marvell.com>, <conor.walsh@intel.com>,\n <vattunuru@marvell.com>, <g.singh@nxp.com>,\n <sachin.saxena@oss.nxp.com>, <hemant.agrawal@nxp.com>,\n <cheng1.jiang@intel.com>, <ndabilpuram@marvell.com>,\n <anoobj@marvell.com>, <mb@smartsharesystems.com>,\n Amit Prakash Shukla <amitprakashs@marvell.com>", "Subject": "[PATCH v4 2/2] test/dma: auto free offload test to free DMA buffer", "Date": "Mon, 9 Oct 2023 17:32:36 +0530", "Message-ID": "<20231009120236.1641008-3-amitprakashs@marvell.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20231009120236.1641008-1-amitprakashs@marvell.com>", "References": "<20230928115031.259592-1-amitprakashs@marvell.com>\n <20231009120236.1641008-1-amitprakashs@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-GUID": "PYW4JAcpRAM_aQGd7Hho2Mq97ryLAQM-", "X-Proofpoint-ORIG-GUID": "PYW4JAcpRAM_aQGd7Hho2Mq97ryLAQM-", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-10-09_11,2023-10-09_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 a test case to validate the functionality of drivers' dma\nbuffer offload auto free. As part of dmadev_autotest, test case\nwill be executed only if the driver supports buffer offload auto\nfree and if the test is exported by env variable DPDK_ADD_DMA_TEST.\n\nSigned-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>\nAcked-by: Anoob Joseph <anoobj@marvell.com>\n---\n app/test/test_dmadev.c | 167 ++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 166 insertions(+), 1 deletion(-)", "diff": "diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c\nindex 6ef875e545..216f84b6bb 100644\n--- a/app/test/test_dmadev.c\n+++ b/app/test/test_dmadev.c\n@@ -18,11 +18,37 @@\n \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 \n static struct rte_mempool *pool;\n static uint16_t id_count;\n \n+enum {\n+\tTEST_PARAM_REMOTE_ADDR = 0,\n+\tTEST_PARAM_MAX,\n+};\n+\n+static const char * const dma_test_param[] = {\n+\t[TEST_PARAM_REMOTE_ADDR] = \"remote_addr\",\n+};\n+\n+static uint64_t env_test_param[TEST_PARAM_MAX];\n+\n+enum {\n+\tTEST_M2D_AUTO_FREE = 0,\n+\tTEST_MAX,\n+};\n+\n+struct dma_add_test {\n+\tconst char *name;\n+\tbool enabled;\n+};\n+\n+struct dma_add_test dma_add_test[] = {\n+\t[TEST_M2D_AUTO_FREE] = {.name = \"m2d_auto_free\", .enabled = false},\n+};\n+\n static void\n __rte_format_printf(3, 4)\n print_err(const char *func, int lineno, const char *format, ...)\n@@ -797,10 +823,103 @@ test_burst_capacity(int16_t dev_id, uint16_t vchan)\n \treturn 0;\n }\n \n+static int\n+test_m2d_auto_free(int16_t dev_id, uint16_t vchan)\n+{\n+#define NR_MBUF 256\n+\tstruct rte_mbuf *src[NR_MBUF], *dst[NR_MBUF];\n+\tconst struct rte_dma_vchan_conf qconf = {\n+\t\t.direction = RTE_DMA_DIR_MEM_TO_DEV,\n+\t\t.nb_desc = TEST_RINGSIZE,\n+\t\t.auto_free.m2d.pool = pool,\n+\t\t.dst_port.port_type = RTE_DMA_PORT_PCIE,\n+\t\t.dst_port.pcie.coreid = 0,\n+\t};\n+\tuint32_t buf_cnt1, buf_cnt2;\n+\tstruct rte_mempool_ops *ops;\n+\tstatic bool dev_init;\n+\tuint16_t nb_done = 0;\n+\tbool dma_err = false;\n+\tint retry = 100;\n+\tint i, ret = 0;\n+\n+\tif (!dev_init) {\n+\t\t/* Stop the device to reconfigure vchan. */\n+\t\tif (rte_dma_stop(dev_id) < 0)\n+\t\t\tERR_RETURN(\"Error stopping device %u\\n\", dev_id);\n+\n+\t\tif (rte_dma_vchan_setup(dev_id, vchan, &qconf) < 0)\n+\t\t\tERR_RETURN(\"Error with queue configuration\\n\");\n+\n+\t\tif (rte_dma_start(dev_id) != 0)\n+\t\t\tERR_RETURN(\"Error with rte_dma_start()\\n\");\n+\n+\t\tdev_init = true;\n+\t}\n+\n+\tif (rte_pktmbuf_alloc_bulk(pool, dst, NR_MBUF) != 0)\n+\t\tERR_RETURN(\"alloc dst mbufs failed.\\n\");\n+\n+\tfor (i = 0; i < NR_MBUF; i++) {\n+\t\t/* Using mbuf structure to hold remote iova address. */\n+\t\trte_mbuf_iova_set(dst[i], (rte_iova_t)env_test_param[TEST_PARAM_REMOTE_ADDR]);\n+\t\tdst[i]->data_off = 0;\n+\t}\n+\n+\t/* Capture buffer count before allocating source buffer. */\n+\tops = rte_mempool_get_ops(pool->ops_index);\n+\tbuf_cnt1 = ops->get_count(pool);\n+\n+\tif (rte_pktmbuf_alloc_bulk(pool, src, NR_MBUF) != 0) {\n+\t\tprintf(\"alloc src mbufs failed.\\n\");\n+\t\tret = -1;\n+\t\tgoto done;\n+\t}\n+\n+\tif ((buf_cnt1 - NR_MBUF) != ops->get_count(pool)) {\n+\t\tprintf(\"Buffer count check failed.\\n\");\n+\t\tret = -1;\n+\t\tgoto done;\n+\t}\n+\n+\tfor (i = 0; i < NR_MBUF; i++) {\n+\t\tret = rte_dma_copy(dev_id, vchan, rte_mbuf_data_iova(src[i]),\n+\t\t\t\t rte_mbuf_data_iova(dst[i]), COPY_LEN,\n+\t\t\t\t RTE_DMA_OP_FLAG_AUTO_FREE);\n+\n+\t\tif (ret < 0) {\n+\t\t\tprintf(\"rte_dma_copy returned error.\\n\");\n+\t\t\tgoto done;\n+\t\t}\n+\t}\n+\n+\trte_dma_submit(dev_id, vchan);\n+\tdo {\n+\t\tnb_done += rte_dma_completed(dev_id, vchan, (NR_MBUF - nb_done), NULL, &dma_err);\n+\t\tif (dma_err)\n+\t\t\tbreak;\n+\t\t/* Sleep for 1 millisecond */\n+\t\trte_delay_us_sleep(1000);\n+\t} while (retry-- && (nb_done < NR_MBUF));\n+\n+\tbuf_cnt2 = ops->get_count(pool);\n+\tif ((buf_cnt1 != buf_cnt2) || dma_err) {\n+\t\tprintf(\"Free mem to dev buffer test failed.\\n\");\n+\t\tret = -1;\n+\t}\n+\n+done:\n+\trte_pktmbuf_free_bulk(dst, NR_MBUF);\n+\t/* If the test passes source buffer will be freed in hardware. */\n+\tif (ret < 0)\n+\t\trte_pktmbuf_free_bulk(&src[nb_done], (NR_MBUF - nb_done));\n+\n+\treturn ret;\n+}\n+\n static int\n test_dmadev_instance(int16_t dev_id)\n {\n-#define TEST_RINGSIZE 512\n #define CHECK_ERRS true\n \tstruct rte_dma_stats stats;\n \tstruct rte_dma_info info;\n@@ -890,6 +1009,13 @@ test_dmadev_instance(int16_t dev_id)\n \telse if (runtest(\"fill\", test_enqueue_fill, 1, dev_id, vchan, CHECK_ERRS) < 0)\n \t\tgoto err;\n \n+\tif ((info.dev_capa & RTE_DMA_CAPA_M2D_AUTO_FREE) &&\n+\t dma_add_test[TEST_M2D_AUTO_FREE].enabled == true) {\n+\t\tif (runtest(\"m2d_auto_free\", test_m2d_auto_free, 128, dev_id, vchan,\n+\t\t\t CHECK_ERRS) < 0)\n+\t\t\tgoto err;\n+\t}\n+\n \trte_mempool_free(pool);\n \n \tif (rte_dma_stop(dev_id) < 0)\n@@ -922,11 +1048,50 @@ test_apis(void)\n \treturn ret;\n }\n \n+static void\n+parse_dma_env_var(void)\n+{\n+\tchar *dma_env_param_str = getenv(\"DPDK_ADD_DMA_TEST_PARAM\");\n+\tchar *dma_env_test_str = getenv(\"DPDK_ADD_DMA_TEST\");\n+\tchar *params[32] = {0};\n+\tchar *tests[32] = {0};\n+\tchar *var[2] = {0};\n+\tint n_var = 0;\n+\tint i, j;\n+\n+\t/* Additional test from commandline. */\n+\tif (dma_env_test_str && strlen(dma_env_test_str) > 0) {\n+\t\tn_var = rte_strsplit(dma_env_test_str, strlen(dma_env_test_str), tests,\n+\t\t\t\tRTE_DIM(tests), ',');\n+\t\tfor (i = 0; i < n_var; i++) {\n+\t\t\tfor (j = 0; j < TEST_MAX; j++) {\n+\t\t\t\tif (!strcmp(tests[i], dma_add_test[j].name))\n+\t\t\t\t\tdma_add_test[j].enabled = true;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Commandline variables for test */\n+\tif (dma_env_param_str && strlen(dma_env_param_str) > 0) {\n+\t\tn_var = rte_strsplit(dma_env_param_str, strlen(dma_env_param_str), params,\n+\t\t\t\t RTE_DIM(params), ',');\n+\t\tfor (i = 0; i < n_var; i++) {\n+\t\t\trte_strsplit(params[i], strlen(params[i]), var,\tRTE_DIM(var), '=');\n+\t\t\tfor (j = 0; j < TEST_PARAM_MAX; j++) {\n+\t\t\t\tif (!strcmp(var[0], dma_test_param[j]))\n+\t\t\t\t\tenv_test_param[j] = strtoul(var[1], NULL, 16);\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n static int\n test_dma(void)\n {\n \tint i;\n \n+\tparse_dma_env_var();\n+\n \t/* basic sanity on dmadev infrastructure */\n \tif (test_apis() < 0)\n \t\tERR_RETURN(\"Error performing API tests\\n\");\n", "prefixes": [ "v4", "2/2" ] }{ "id": 132423, "url": "