get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81731,
    "url": "http://patches.dpdk.org/api/patches/81731/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201022064625.90974-2-Cheng1.jiang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20201022064625.90974-2-Cheng1.jiang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201022064625.90974-2-Cheng1.jiang@intel.com",
    "date": "2020-10-22T06:46:22",
    "name": "[v9,1/4] example/vhost: add async vhost args parsing function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4c2dbe57fb9dad77d83f6bbf93384fa23f500e80",
    "submitter": {
        "id": 1530,
        "url": "http://patches.dpdk.org/api/people/1530/?format=api",
        "name": "Jiang, Cheng1",
        "email": "Cheng1.jiang@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201022064625.90974-2-Cheng1.jiang@intel.com/mbox/",
    "series": [
        {
            "id": 13190,
            "url": "http://patches.dpdk.org/api/series/13190/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13190",
            "date": "2020-10-22T06:46:21",
            "name": "add async data path in vhost sample",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/13190/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/81731/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/81731/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C90D9A04DD;\n\tThu, 22 Oct 2020 08:59:52 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5906769F8;\n\tThu, 22 Oct 2020 08:59:48 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by dpdk.org (Postfix) with ESMTP id 01EE75A9C\n for <dev@dpdk.org>; Thu, 22 Oct 2020 08:59:32 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Oct 2020 23:59:32 -0700",
            "from dpdk_jiangcheng.sh.intel.com ([10.67.119.112])\n by orsmga007.jf.intel.com with ESMTP; 21 Oct 2020 23:59:30 -0700"
        ],
        "IronPort-SDR": [
            "\n goD7YOd/Tlj57lB0Wng60uZGw3p6gvSescJS6iDaex9jN+PnD9UmQ53bPjzOdp1wHyyy5uWgpa\n EWujMQV5p4mg==",
            "\n 9lXLtz07Sr2jfjaAmXKVypa3pP74W8UTovGcQr7Pna5wNKMz8awYIskuwlfqp29C8b+ph2JtKl\n SW+KRlz4wOGg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9781\"; a=\"146774881\"",
            "E=Sophos;i=\"5.77,403,1596524400\"; d=\"scan'208\";a=\"146774881\"",
            "E=Sophos;i=\"5.77,403,1596524400\"; d=\"scan'208\";a=\"359772085\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Cheng Jiang <Cheng1.jiang@intel.com>",
        "To": "maxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com",
        "Cc": "dev@dpdk.org, patrick.fu@intel.com, YvonneX.Yang@intel.com,\n Cheng Jiang <Cheng1.jiang@intel.com>",
        "Date": "Thu, 22 Oct 2020 06:46:22 +0000",
        "Message-Id": "<20201022064625.90974-2-Cheng1.jiang@intel.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201022064625.90974-1-Cheng1.jiang@intel.com>",
        "References": "<20201021065044.31839-1-Cheng1.jiang@intel.com>\n <20201022064625.90974-1-Cheng1.jiang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v9 1/4] example/vhost: add async vhost args\n\tparsing function",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch is to add async vhost driver arguments parsing function\nfor CBDMA channel, DMA initiation function and args description.\nThe meson build file is changed to fix dependency problem. With\nthese arguments vhost device can be set to use CBDMA or CPU for\nenqueue operation and bind vhost device with specific CBDMA channel\nto accelerate data copy.\n\nSigned-off-by: Cheng Jiang <Cheng1.jiang@intel.com>\n---\n examples/vhost/ioat.c      | 99 ++++++++++++++++++++++++++++++++++++++\n examples/vhost/ioat.h      | 35 ++++++++++++++\n examples/vhost/main.c      | 36 +++++++++++++-\n examples/vhost/meson.build |  5 ++\n 4 files changed, 174 insertions(+), 1 deletion(-)\n create mode 100644 examples/vhost/ioat.c\n create mode 100644 examples/vhost/ioat.h",
    "diff": "diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c\nnew file mode 100644\nindex 000000000..52767d599\n--- /dev/null\n+++ b/examples/vhost/ioat.c\n@@ -0,0 +1,99 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2020 Intel Corporation\n+ */\n+#include <rte_rawdev.h>\n+#include <rte_ioat_rawdev.h>\n+\n+#include \"ioat.h\"\n+#include \"main.h\"\n+\n+int\n+open_ioat(const char *value)\n+{\n+\tstruct dma_for_vhost *dma_info = dma_bind;\n+\tchar *input = strndup(value, strlen(value) + 1);\n+\tchar *addrs = input;\n+\tchar *ptrs[2];\n+\tchar *start, *end, *substr;\n+\tint64_t vid, vring_id;\n+\tstruct rte_ioat_rawdev_config config;\n+\tstruct rte_rawdev_info info = { .dev_private = &config };\n+\tchar name[32];\n+\tint dev_id;\n+\tint ret = 0;\n+\tuint16_t i = 0;\n+\tchar *dma_arg[MAX_VHOST_DEVICE];\n+\tuint8_t args_nr;\n+\n+\twhile (isblank(*addrs))\n+\t\taddrs++;\n+\tif (*addrs == '\\0') {\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n+\n+\t/* process DMA devices within bracket. */\n+\taddrs++;\n+\tsubstr = strtok(addrs, \";]\");\n+\tif (!substr) {\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n+\targs_nr = rte_strsplit(substr, strlen(substr),\n+\t\t\tdma_arg, MAX_VHOST_DEVICE, ',');\n+\tdo {\n+\t\tchar *arg_temp = dma_arg[i];\n+\t\trte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@');\n+\n+\t\tstart = strstr(ptrs[0], \"txd\");\n+\t\tif (start == NULL) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tstart += 3;\n+\t\tvid = strtol(start, &end, 0);\n+\t\tif (end == start) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tvring_id = 0 + VIRTIO_RXQ;\n+\t\tif (rte_pci_addr_parse(ptrs[1],\n+\t\t\t\t&(dma_info + vid)->dmas[vring_id].addr) < 0) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\trte_pci_device_name(&(dma_info + vid)->dmas[vring_id].addr,\n+\t\t\t\tname, sizeof(name));\n+\t\tdev_id = rte_rawdev_get_dev_id(name);\n+\t\tif (dev_id == (uint16_t)(-ENODEV) ||\n+\t\tdev_id == (uint16_t)(-EINVAL)) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tif (rte_rawdev_info_get(dev_id, &info, sizeof(config)) < 0 ||\n+\t\tstrstr(info.driver_name, \"ioat\") == NULL) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\t(dma_info + vid)->dmas[vring_id].dev_id = dev_id;\n+\t\t(dma_info + vid)->dmas[vring_id].is_valid = true;\n+\t\tconfig.ring_size = IOAT_RING_SIZE;\n+\t\tconfig.hdls_disable = true;\n+\t\tif (rte_rawdev_configure(dev_id, &info, sizeof(config)) < 0) {\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n+\t\t}\n+\t\trte_rawdev_start(dev_id);\n+\n+\t\tdma_info->nr++;\n+\t\ti++;\n+\t} while (i < args_nr);\n+out:\n+\tfree(input);\n+\treturn ret;\n+}\ndiff --git a/examples/vhost/ioat.h b/examples/vhost/ioat.h\nnew file mode 100644\nindex 000000000..02c1a8d35\n--- /dev/null\n+++ b/examples/vhost/ioat.h\n@@ -0,0 +1,35 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2020 Intel Corporation\n+ */\n+\n+#ifndef _IOAT_H_\n+#define _IOAT_H_\n+\n+#include <rte_vhost.h>\n+#include <rte_pci.h>\n+\n+#define MAX_VHOST_DEVICE 1024\n+#define IOAT_RING_SIZE 4096\n+\n+struct dma_info {\n+\tstruct rte_pci_addr addr;\n+\tuint16_t dev_id;\n+\tbool is_valid;\n+};\n+\n+struct dma_for_vhost {\n+\tstruct dma_info dmas[RTE_MAX_QUEUES_PER_PORT * 2];\n+\tuint16_t nr;\n+};\n+\n+struct dma_for_vhost dma_bind[MAX_VHOST_DEVICE];\n+\n+#ifdef RTE_ARCH_X86\n+int open_ioat(const char *value);\n+#else\n+static int open_ioat(const char *value __rte_unused)\n+{\n+\treturn -1;\n+}\n+#endif\n+#endif /* _IOAT_H_ */\ndiff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex faa482245..08182ff01 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -25,6 +25,7 @@\n #include <rte_tcp.h>\n #include <rte_pause.h>\n \n+#include \"ioat.h\"\n #include \"main.h\"\n \n #ifndef MAX_QUEUES\n@@ -95,6 +96,10 @@ static int client_mode;\n \n static int builtin_net_driver;\n \n+static int async_vhost_driver;\n+\n+static char dma_type[MAX_LONG_OPT_SZ];\n+\n /* Specify timeout (in useconds) between retries on RX. */\n static uint32_t burst_rx_delay_time = BURST_RX_WAIT_US;\n /* Specify the number of retries on RX. */\n@@ -181,6 +186,15 @@ struct mbuf_table lcore_tx_queue[RTE_MAX_LCORE];\n \t\t\t\t / US_PER_S * BURST_TX_DRAIN_US)\n #define VLAN_HLEN       4\n \n+static inline int\n+open_dma(const char *value)\n+{\n+\tif (strncmp(dma_type, \"ioat\", 4) == 0)\n+\t\treturn open_ioat(value);\n+\n+\treturn -1;\n+}\n+\n /*\n  * Builds up the correct configuration for VMDQ VLAN pool map\n  * according to the pool & queue limits.\n@@ -446,7 +460,9 @@ us_vhost_usage(const char *prgname)\n \t\"\t\t--socket-file: The path of the socket file.\\n\"\n \t\"\t\t--tx-csum [0|1] disable/enable TX checksum offload.\\n\"\n \t\"\t\t--tso [0|1] disable/enable TCP segment offload.\\n\"\n-\t\"\t\t--client register a vhost-user socket as client mode.\\n\",\n+\t\"\t\t--client register a vhost-user socket as client mode.\\n\"\n+\t\"\t\t--dma-type register dma type for your vhost async driver. For example \\\"ioat\\\" for now.\\n\"\n+\t\"\t\t--dmas register dma channel for specific vhost device.\\n\",\n \t       prgname);\n }\n \n@@ -472,6 +488,8 @@ us_vhost_parse_args(int argc, char **argv)\n \t\t{\"tso\", required_argument, NULL, 0},\n \t\t{\"client\", no_argument, &client_mode, 1},\n \t\t{\"builtin-net-driver\", no_argument, &builtin_net_driver, 1},\n+\t\t{\"dma-type\", required_argument, NULL, 0},\n+\t\t{\"dmas\", required_argument, NULL, 0},\n \t\t{NULL, 0, 0, 0},\n \t};\n \n@@ -614,6 +632,22 @@ us_vhost_parse_args(int argc, char **argv)\n \t\t\t\t}\n \t\t\t}\n \n+\t\t\tif (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\t\"dma-type\", MAX_LONG_OPT_SZ)) {\n+\t\t\t\tstrcpy(dma_type, optarg);\n+\t\t\t}\n+\n+\t\t\tif (!strncmp(long_option[option_index].name,\n+\t\t\t\t\t\t\"dmas\", MAX_LONG_OPT_SZ)) {\n+\t\t\t\tif (open_dma(optarg) == -1) {\n+\t\t\t\t\tRTE_LOG(INFO, VHOST_CONFIG,\n+\t\t\t\t\t\t\"Wrong DMA args\\n\");\n+\t\t\t\t\tus_vhost_usage(prgname);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tasync_vhost_driver = 1;\n+\t\t\t}\n+\n \t\t\tbreak;\n \n \t\t\t/* Invalid option - print options. */\ndiff --git a/examples/vhost/meson.build b/examples/vhost/meson.build\nindex 872d51153..24f1f7131 100644\n--- a/examples/vhost/meson.build\n+++ b/examples/vhost/meson.build\n@@ -14,3 +14,8 @@ allow_experimental_apis = true\n sources = files(\n \t'main.c', 'virtio_net.c'\n )\n+\n+if dpdk_conf.has('RTE_ARCH_X86')\n+\tdeps += 'raw_ioat'\n+\tsources += files('ioat.c')\n+endif\n",
    "prefixes": [
        "v9",
        "1/4"
    ]
}