get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86250,
    "url": "https://patches.dpdk.org/api/patches/86250/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210110111023.9525-4-ophirmu@nvidia.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": "<20210110111023.9525-4-ophirmu@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210110111023.9525-4-ophirmu@nvidia.com",
    "date": "2021-01-10T11:10:20",
    "name": "[v3,3/6] app/regex: read data file once at startup",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b7ba1a89bd97a188afd9defe96d295467e7388f5",
    "submitter": {
        "id": 1908,
        "url": "https://patches.dpdk.org/api/people/1908/?format=api",
        "name": "Ophir Munk",
        "email": "ophirmu@nvidia.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/20210110111023.9525-4-ophirmu@nvidia.com/mbox/",
    "series": [
        {
            "id": 14620,
            "url": "https://patches.dpdk.org/api/series/14620/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14620",
            "date": "2021-01-10T11:10:19",
            "name": "regex multi Q with multi cores support",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/14620/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/86250/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/86250/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 (xvm-189-124.dc0.ghst.net [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BEC38A04B5;\n\tSun, 10 Jan 2021 12:10:47 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C6C0D140F6F;\n\tSun, 10 Jan 2021 12:10:30 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id C7C1D140F0C\n for <dev@dpdk.org>; Sun, 10 Jan 2021 12:10:25 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n ophirmu@nvidia.com) with SMTP; 10 Jan 2021 13:10:25 +0200",
            "from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10ABAOOm032562;\n Sun, 10 Jan 2021 13:10:25 +0200"
        ],
        "From": "Ophir Munk <ophirmu@nvidia.com>",
        "To": "dev@dpdk.org",
        "Cc": "Ori Kam <orika@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,\n Ophir Munk <ophirmu@mellanox.com>",
        "Date": "Sun, 10 Jan 2021 11:10:20 +0000",
        "Message-Id": "<20210110111023.9525-4-ophirmu@nvidia.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210110111023.9525-1-ophirmu@nvidia.com>",
        "References": "<20201220104148.13961-2-ophirmu@nvidia.com>\n <20210110111023.9525-1-ophirmu@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/6] app/regex: read data file once at startup",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Up to this commit the input data file was read from scratch for each QP,\nwhich is redundant. Starting from this commit the data file is read only\nonce at startup. Each QP will clone the data.\n\nSigned-off-by: Ophir Munk <ophirmu@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\n app/test-regex/main.c | 63 +++++++++++++++++++++++++++++++--------------------\n 1 file changed, 39 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/app/test-regex/main.c b/app/test-regex/main.c\nindex d225267..9bafd02 100644\n--- a/app/test-regex/main.c\n+++ b/app/test-regex/main.c\n@@ -180,6 +180,19 @@ read_file(char *file, char **buf)\n }\n \n static int\n+clone_buf(char *data_buf, char **buf, long data_len)\n+{\n+\tchar *dest_buf;\n+\tdest_buf =\n+\t\trte_malloc(NULL, sizeof(char) * (data_len + 1), 4096);\n+\tif (!dest_buf)\n+\t\treturn -ENOMEM;\n+\tmemcpy(dest_buf, data_buf, data_len + 1);\n+\t*buf = dest_buf;\n+\treturn 0;\n+}\n+\n+static int\n init_port(uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches,\n \t  uint32_t nb_qps)\n {\n@@ -262,12 +275,11 @@ extbuf_free_cb(void *addr __rte_unused, void *fcb_opaque __rte_unused)\n \n static int\n run_regex(uint32_t nb_jobs,\n-\t  uint16_t nb_max_payload, bool perf_mode, uint32_t nb_iterations,\n-\t  char *data_file, uint8_t nb_max_matches, uint32_t nb_qps)\n+\t  bool perf_mode, uint32_t nb_iterations,\n+\t  uint8_t nb_max_matches, uint32_t nb_qps,\n+\t  char *data_buf, long data_len, long job_len)\n {\n \tchar *buf = NULL;\n-\tlong buf_len = 0;\n-\tlong job_len = 0;\n \tuint32_t actual_jobs = 0;\n \tuint32_t i;\n \tuint16_t qp_id;\n@@ -344,22 +356,8 @@ run_regex(uint32_t nb_jobs,\n \t\t\t}\n \t\t}\n \n-\t\tbuf_len = read_file(data_file, &buf);\n-\t\tif (buf_len <= 0) {\n-\t\t\tprintf(\"Error, can't read file, or file is empty.\\n\");\n-\t\t\tres = -EXIT_FAILURE;\n-\t\t\tgoto end;\n-\t\t}\n-\n-\t\tjob_len = buf_len / nb_jobs;\n-\t\tif (job_len == 0) {\n-\t\t\tprintf(\"Error, To many jobs, for the given input.\\n\");\n-\t\t\tres = -EXIT_FAILURE;\n-\t\t\tgoto end;\n-\t\t}\n-\n-\t\tif (job_len > nb_max_payload) {\n-\t\t\tprintf(\"Error, not enough jobs to cover input.\\n\");\n+\t\tif (clone_buf(data_buf, &buf, data_len)) {\n+\t\t\tprintf(\"Error, can't clone buf.\\n\");\n \t\t\tres = -EXIT_FAILURE;\n \t\t\tgoto end;\n \t\t}\n@@ -367,8 +365,8 @@ run_regex(uint32_t nb_jobs,\n \t\t/* Assign each mbuf with the data to handle. */\n \t\tactual_jobs = 0;\n \t\tpos = 0;\n-\t\tfor (i = 0; (pos < buf_len) && (i < nb_jobs) ; i++) {\n-\t\t\tlong act_job_len = RTE_MIN(job_len, buf_len - pos);\n+\t\tfor (i = 0; (pos < data_len) && (i < nb_jobs) ; i++) {\n+\t\t\tlong act_job_len = RTE_MIN(job_len, data_len - pos);\n \t\t\trte_pktmbuf_attach_extbuf(ops[i]->mbuf, &buf[pos], 0,\n \t\t\t\t\tact_job_len, &shinfo);\n \t\t\tjobs_ctx[i].mbuf = ops[i]->mbuf;\n@@ -505,6 +503,9 @@ main(int argc, char **argv)\n \tuint16_t nb_max_payload = 0;\n \tuint8_t nb_max_matches = 0;\n \tuint32_t nb_qps = 1;\n+\tchar *data_buf;\n+\tlong data_len;\n+\tlong job_len;\n \n \t/* Init EAL. */\n \tret = rte_eal_init(argc, argv);\n@@ -522,10 +523,24 @@ main(int argc, char **argv)\n \t\t\t&nb_max_matches, nb_qps);\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"init port failed\\n\");\n-\tret = run_regex(nb_jobs, nb_max_payload, perf_mode,\n-\t\t\tnb_iterations, data_file, nb_max_matches, nb_qps);\n+\n+\tdata_len = read_file(data_file, &data_buf);\n+\tif (data_len <= 0)\n+\t\trte_exit(EXIT_FAILURE, \"Error, can't read file, or file is empty.\\n\");\n+\n+\tjob_len = data_len / nb_jobs;\n+\tif (job_len == 0)\n+\t\trte_exit(EXIT_FAILURE, \"Error, To many jobs, for the given input.\\n\");\n+\n+\tif (job_len > nb_max_payload)\n+\t\trte_exit(EXIT_FAILURE, \"Error, not enough jobs to cover input.\\n\");\n+\n+\tret = run_regex(nb_jobs, perf_mode,\n+\t\t\tnb_iterations, nb_max_matches, nb_qps,\n+\t\t\tdata_buf, data_len, job_len);\n \tif (ret < 0) {\n \t\trte_exit(EXIT_FAILURE, \"RegEx function failed\\n\");\n \t}\n+\trte_free(data_buf);\n \treturn EXIT_SUCCESS;\n }\n",
    "prefixes": [
        "v3",
        "3/6"
    ]
}