get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137502,
    "url": "https://patches.dpdk.org/api/patches/137502/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240229141426.4188428-1-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": "<20240229141426.4188428-1-amitprakashs@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240229141426.4188428-1-amitprakashs@marvell.com",
    "date": "2024-02-29T14:14:26",
    "name": "[v3] app/dma-perf: support bi-directional transfer",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9293e89ac425bedb42871676a595de143a5a7fbc",
    "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/20240229141426.4188428-1-amitprakashs@marvell.com/mbox/",
    "series": [
        {
            "id": 31300,
            "url": "https://patches.dpdk.org/api/series/31300/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31300",
            "date": "2024-02-29T14:14:26",
            "name": "[v3] app/dma-perf: support bi-directional transfer",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/31300/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/137502/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/137502/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 7B2C643C3B;\n\tThu, 29 Feb 2024 15:45:47 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 67D45402CD;\n\tThu, 29 Feb 2024 15:45:47 +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 17AC5402B4\n for <dev@dpdk.org>; Thu, 29 Feb 2024 15:45:45 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id\n 41T7O48D029034; Thu, 29 Feb 2024 06:45:45 -0800",
            "from dc6wp-exch02.marvell.com ([4.21.29.225])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3wjfay360t-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 29 Feb 2024 06:45:45 -0800 (PST)",
            "from DC6WP-EXCH02.marvell.com (10.76.176.209) by\n DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.1258.12; Thu, 29 Feb 2024 06:45:44 -0800",
            "from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com\n (10.76.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend\n Transport; Thu, 29 Feb 2024 06:45:44 -0800",
            "from cavium-OptiPlex-5090-BM14.. (unknown [10.28.36.157])\n by maili.marvell.com (Postfix) with ESMTP id 442A73F7A3C;\n Thu, 29 Feb 2024 06:14:31 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding:content-type; s=\n pfpt0220; bh=igfuKDwXA9f1joiZX4d6igz42rjW8cC1J8q8xPitLUI=; b=iq2\n sWabT4vUUPlH72xVxLUIkIz4y9lU37yFwO/cvrJyob2FPT0ulE5b7w6WugYL0XLy\n jAB9+OBhvgDla+ylb7EEjQuOIJKDGFymwwu0zuZF9OqHTX+NEd0Thx8enF0D6KJZ\n I2i/fanTQZiVJnKQKsFoWaXSZT4NDb+LJbP6b177PW50xyKUprMHnNaHYX+8NdUl\n 0fyScL9F0c3NC3b01EKVfD8x1dChP00zNC7ROUr3H5F1G4kJk0R/SqlHo1qnX45V\n Gi7AT7Rhzkz+/8i94T8drJUO6MSUl2bzSjJC4nap62hFUFZUiYWx2VzYzqKbhfjk\n 2KicfyLYSeQgsIvpRIw==",
        "From": "Amit Prakash Shukla <amitprakashs@marvell.com>",
        "To": "Cheng Jiang <honest.jiang@foxmail.com>, Chengwen Feng\n <fengchengwen@huawei.com>",
        "CC": "<dev@dpdk.org>, <jerinj@marvell.com>, <anoobj@marvell.com>,\n <kevin.laatz@intel.com>, <bruce.richardson@intel.com>,\n <pbhagavatula@marvell.com>, <gmuthukrishn@marvell.com>, Amit Prakash Shukla\n <amitprakashs@marvell.com>",
        "Subject": "[PATCH v3] app/dma-perf: support bi-directional transfer",
        "Date": "Thu, 29 Feb 2024 19:44:26 +0530",
        "Message-ID": "<20240229141426.4188428-1-amitprakashs@marvell.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240227192601.3932913-1-amitprakashs@marvell.com>",
        "References": "<20240227192601.3932913-1-amitprakashs@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "0CPaEIeHLinXeHYG4pMvFjnfanoqQgdd",
        "X-Proofpoint-GUID": "0CPaEIeHLinXeHYG4pMvFjnfanoqQgdd",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2024-02-29_02,2024-02-29_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": "Adds bi-directional DMA transfer support to test performance.\nOne DMA device on one core will do mem2dev transfer and another\nDMA device on another core will do dev2mem transfer.\n\nDepends-on: series-31298 (\"PCI Dev and SG copy support\")\n\nSigned-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>\n---\nv3:\n- Rebased with dependent series.\n\n app/test-dma-perf/benchmark.c | 65 +++++++++++++++++++++++++++--------\n app/test-dma-perf/config.ini  |  5 +++\n app/test-dma-perf/main.c      | 18 +++++++++-\n app/test-dma-perf/main.h      |  1 +\n 4 files changed, 74 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c\nindex d821af8532..79de80499f 100644\n--- a/app/test-dma-perf/benchmark.c\n+++ b/app/test-dma-perf/benchmark.c\n@@ -148,12 +148,19 @@ cache_flush_buf(__rte_unused struct rte_mbuf **array,\n \n static int\n vchan_data_populate(uint32_t dev_id, struct rte_dma_vchan_conf *qconf,\n-\t\t    struct test_configure *cfg)\n+\t\t    struct test_configure *cfg, uint16_t dev_num)\n {\n \tstruct rte_dma_info info;\n \n \tqconf->direction = cfg->transfer_dir;\n \n+\t/* If its a bi-directional test, configure odd device for inbound dma\n+\t * transfer and even device for outbound dma transfer.\n+\t */\n+\tif (cfg->is_bidir)\n+\t\tqconf->direction = (dev_num % 2) ? RTE_DMA_DIR_MEM_TO_DEV :\n+\t\t\t\t   RTE_DMA_DIR_DEV_TO_MEM;\n+\n \trte_dma_info_get(dev_id, &info);\n \tif (!(RTE_BIT64(qconf->direction) & info.dev_capa))\n \t\treturn -1;\n@@ -185,14 +192,15 @@ vchan_data_populate(uint32_t dev_id, struct rte_dma_vchan_conf *qconf,\n \n /* Configuration of device. */\n static void\n-configure_dmadev_queue(uint32_t dev_id, struct test_configure *cfg, uint8_t sges_max)\n+configure_dmadev_queue(uint32_t dev_id, struct test_configure *cfg, uint8_t sges_max,\n+\t\t       uint16_t dev_num)\n {\n \tuint16_t vchan = 0;\n \tstruct rte_dma_info info;\n \tstruct rte_dma_conf dev_config = { .nb_vchans = 1 };\n \tstruct rte_dma_vchan_conf qconf = { 0 };\n \n-\tif (vchan_data_populate(dev_id, &qconf, cfg) != 0)\n+\tif (vchan_data_populate(dev_id, &qconf, cfg, dev_num) != 0)\n \t\trte_exit(EXIT_FAILURE, \"Error with vchan data populate.\\n\");\n \n \tif (rte_dma_configure(dev_id, &dev_config) != 0)\n@@ -239,7 +247,7 @@ config_dmadevs(struct test_configure *cfg)\n \t\t}\n \n \t\tldm->dma_ids[i] = dev_id;\n-\t\tconfigure_dmadev_queue(dev_id, cfg, nb_sges);\n+\t\tconfigure_dmadev_queue(dev_id, cfg, nb_sges, nb_dmadevs);\n \t\t++nb_dmadevs;\n \t}\n \n@@ -508,7 +516,7 @@ setup_memory_env(struct test_configure *cfg,\n \t\t}\n \t}\n \n-\tif (cfg->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM) {\n+\tif (cfg->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM && !cfg->is_bidir) {\n \t\text_buf_info->free_cb = dummy_free_ext_buf;\n \t\text_buf_info->fcb_opaque = NULL;\n \t\tfor (i = 0; i < nr_buf; i++) {\n@@ -521,7 +529,7 @@ setup_memory_env(struct test_configure *cfg,\n \t\t}\n \t}\n \n-\tif (cfg->transfer_dir == RTE_DMA_DIR_MEM_TO_DEV) {\n+\tif (cfg->transfer_dir == RTE_DMA_DIR_MEM_TO_DEV && !cfg->is_bidir) {\n \t\text_buf_info->free_cb = dummy_free_ext_buf;\n \t\text_buf_info->fcb_opaque = NULL;\n \t\tfor (i = 0; i < nr_buf; i++) {\n@@ -534,6 +542,19 @@ setup_memory_env(struct test_configure *cfg,\n \t\t}\n \t}\n \n+\tif (cfg->is_bidir) {\n+\t\text_buf_info->free_cb = dummy_free_ext_buf;\n+\t\text_buf_info->fcb_opaque = NULL;\n+\t\tfor (i = 0; i < nr_buf; i++) {\n+\t\t\t/* Using mbuf structure to hold remote iova address. */\n+\t\t\trte_pktmbuf_attach_extbuf((*srcs)[i],\n+\t\t\t\t(void *)(cfg->vchan_dev.raddr + (i * buf_size)),\n+\t\t\t\t(rte_iova_t)(cfg->vchan_dev.raddr + (i * buf_size)),\n+\t\t\t\t0, ext_buf_info);\n+\t\t\trte_mbuf_ext_refcnt_update(ext_buf_info, 1);\n+\t\t}\n+\t}\n+\n \tif (cfg->is_sg) {\n \t\tuint8_t nb_src_sges = cfg->nb_src_sges;\n \t\tuint8_t nb_dst_sges = cfg->nb_dst_sges;\n@@ -676,16 +697,30 @@ mem_copy_benchmark(struct test_configure *cfg)\n \t\tlcores[i]->nr_buf = (uint32_t)(nr_buf / nb_workers);\n \t\tlcores[i]->buf_size = buf_size;\n \t\tlcores[i]->test_secs = test_secs;\n-\t\tlcores[i]->srcs = srcs + offset;\n-\t\tlcores[i]->dsts = dsts + offset;\n \t\tlcores[i]->scenario_id = cfg->scenario_id;\n \t\tlcores[i]->lcore_id = lcore_id;\n \n-\t\tif (cfg->is_sg) {\n-\t\t\tlcores[i]->sge.nb_srcs = cfg->nb_src_sges;\n-\t\t\tlcores[i]->sge.nb_dsts = cfg->nb_dst_sges;\n-\t\t\tlcores[i]->sge.srcs = src_sges + (nr_sgsrc / nb_workers * i);\n-\t\t\tlcores[i]->sge.dsts = dst_sges + (nr_sgdst / nb_workers * i);\n+\t\t/* Number of workers is equal to number of devices. In case of bi-directional\n+\t\t * dma, use 1 device for mem-to-dev and 1 device for dev-to-mem.\n+\t\t */\n+\t\tif (cfg->is_dma && cfg->is_bidir && (i % 2 != 0)) {\n+\t\t\tlcores[i]->dsts = srcs + offset;\n+\t\t\tlcores[i]->srcs = dsts + offset;\n+\t\t\tif (cfg->is_sg) {\n+\t\t\t\tlcores[i]->sge.nb_dsts = cfg->nb_src_sges;\n+\t\t\t\tlcores[i]->sge.nb_srcs = cfg->nb_dst_sges;\n+\t\t\t\tlcores[i]->sge.dsts = src_sges + (nr_sgsrc / nb_workers * i);\n+\t\t\t\tlcores[i]->sge.srcs = dst_sges + (nr_sgdst / nb_workers * i);\n+\t\t\t}\n+\t\t} else {\n+\t\t\tlcores[i]->srcs = srcs + offset;\n+\t\t\tlcores[i]->dsts = dsts + offset;\n+\t\t\tif (cfg->is_sg) {\n+\t\t\t\tlcores[i]->sge.nb_srcs = cfg->nb_src_sges;\n+\t\t\t\tlcores[i]->sge.nb_dsts = cfg->nb_dst_sges;\n+\t\t\t\tlcores[i]->sge.srcs = src_sges + (nr_sgsrc / nb_workers * i);\n+\t\t\t\tlcores[i]->sge.dsts = dst_sges + (nr_sgdst / nb_workers * i);\n+\t\t\t}\n \t\t}\n \n \t\trte_eal_remote_launch(get_work_function(cfg), (void *)(lcores[i]),\n@@ -778,6 +813,8 @@ mem_copy_benchmark(struct test_configure *cfg)\n \t\tcalc_result(buf_size, nr_buf, nb_workers, test_secs,\n \t\t\tlcores[i]->worker_info.test_cpl,\n \t\t\t&memory, &avg_cycles, &bandwidth, &mops);\n+\t\tif (cfg->is_bidir)\n+\t\t\tprintf(\"%s direction\\n\", i % 2 ? \"MEM-to-DEV\" : \"DEV-to-MEM\");\n \t\toutput_result(cfg, lcores[i], kick_batch, avg_cycles, buf_size,\n \t\t\tnr_buf / nb_workers, memory, bandwidth, mops);\n \t\tmops_total += mops;\n@@ -791,7 +828,7 @@ mem_copy_benchmark(struct test_configure *cfg)\n \n out:\n \n-\tif (cfg->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM)\n+\tif (cfg->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM || cfg->is_bidir)\n \t\tm = srcs;\n \telse if (cfg->transfer_dir == RTE_DMA_DIR_MEM_TO_DEV)\n \t\tm = dsts;\ndiff --git a/app/test-dma-perf/config.ini b/app/test-dma-perf/config.ini\nindex 2a7e2567d3..541885e34e 100644\n--- a/app/test-dma-perf/config.ini\n+++ b/app/test-dma-perf/config.ini\n@@ -47,6 +47,10 @@\n ;    \"vfid\" denotes VF-id of PF-id to be used for data transfer.\n ;    Example: vchan_dev=raddr=0x400000,coreid=1,pfid=2,vfid=3\n \n+; \"xfer_mode\" denotes mode of data transfer. It can take 2 values:\n+;    0 - unidirection transfer based on direction configured (default).\n+;    1 - Bi-directional transfer based on direction configured (mem-to-dev and dev-to-mem).\n+\n ; Parameters for DMA scatter-gather memory copy:\n ;\n ; \"dma_src_sge\" denotes number of source segments.\n@@ -93,6 +97,7 @@ eal_args=--in-memory --file-prefix=test\n skip=1\n type=DMA_MEM_COPY\n direction=dev2mem\n+xfer_mode=0\n vchan_dev=raddr=0x200000000,coreid=1,pfid=2,vfid=3\n mem_size=10\n buf_size=64,4096,2,MUL\ndiff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c\nindex 18219918cc..b67f8380b2 100644\n--- a/app/test-dma-perf/main.c\n+++ b/app/test-dma-perf/main.c\n@@ -368,6 +368,7 @@ load_configs(const char *path)\n \tconst char *skip;\n \tstruct rte_kvargs *kvlist;\n \tconst char *vchan_dev;\n+\tconst char *xfer_mode;\n \tint args_nr, nb_vp;\n \tbool is_dma;\n \n@@ -421,6 +422,21 @@ load_configs(const char *path)\n \t\t\t\t\ttest_case->transfer_dir = RTE_DMA_DIR_MEM_TO_MEM;\n \t\t\t\t}\n \t\t\t}\n+\n+\t\t\txfer_mode = rte_cfgfile_get_entry(cfgfile, section_name, \"xfer_mode\");\n+\t\t\tif (xfer_mode) {\n+\t\t\t\tint xmode = atoi(xfer_mode);\n+\t\t\t\tif (xmode == 1) {\n+\t\t\t\t\tif (test_case->transfer_dir == RTE_DMA_DIR_MEM_TO_MEM) {\n+\t\t\t\t\t\tprintf(\"Error: Invalid configuration. For mem to\"\n+\t\t\t\t\t\t       \" mem dma transfer bi-directional cannot be\"\n+\t\t\t\t\t\t       \" configured.\\n\");\n+\t\t\t\t\t\ttest_case->is_valid = false;\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t}\n+\t\t\t\t\ttest_case->is_bidir = true;\n+\t\t\t\t}\n+\t\t\t}\n \t\t\tis_dma = true;\n \t\t} else if (strcmp(case_type, CPU_MEM_COPY) == 0) {\n \t\t\ttest_case->test_type = TEST_TYPE_CPU_MEM_COPY;\n@@ -433,7 +449,7 @@ load_configs(const char *path)\n \t\t}\n \n \t\tif (test_case->transfer_dir == RTE_DMA_DIR_MEM_TO_DEV ||\n-\t\t\ttest_case->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM) {\n+\t\t    test_case->transfer_dir == RTE_DMA_DIR_DEV_TO_MEM) {\n \t\t\tvchan_dev = rte_cfgfile_get_entry(cfgfile, section_name, \"vchan_dev\");\n \t\t\tif (vchan_dev == NULL) {\n \t\t\t\tprintf(\"Transfer direction mem2dev and dev2mem\"\ndiff --git a/app/test-dma-perf/main.h b/app/test-dma-perf/main.h\nindex e88d72f54f..e6fe9c7f0b 100644\n--- a/app/test-dma-perf/main.h\n+++ b/app/test-dma-perf/main.h\n@@ -67,6 +67,7 @@ struct test_configure {\n \tconst char *eal_args;\n \tuint8_t scenario_id;\n \tstruct test_vchan_dev_config vchan_dev;\n+\tbool is_bidir;\n };\n \n int mem_copy_benchmark(struct test_configure *cfg);\n",
    "prefixes": [
        "v3"
    ]
}