get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 83839,
    "url": "http://patches.dpdk.org/api/patches/83839/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201109113147.962882-1-grive@u256.net/",
    "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": "<20201109113147.962882-1-grive@u256.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201109113147.962882-1-grive@u256.net",
    "date": "2020-11-09T11:31:47",
    "name": "bus/dpaa: optimize device name parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2faa2ef3e1df2b63e3389927e219b6bb82ca1974",
    "submitter": {
        "id": 1560,
        "url": "http://patches.dpdk.org/api/people/1560/?format=api",
        "name": "Gaëtan Rivet",
        "email": "grive@u256.net"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201109113147.962882-1-grive@u256.net/mbox/",
    "series": [
        {
            "id": 13741,
            "url": "http://patches.dpdk.org/api/series/13741/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13741",
            "date": "2020-11-09T11:31:47",
            "name": "bus/dpaa: optimize device name parsing",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/13741/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/83839/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/83839/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 C9CE2A0527;\n\tMon,  9 Nov 2020 12:31:59 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 76BF95A62;\n\tMon,  9 Nov 2020 12:31:57 +0100 (CET)",
            "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n [217.70.183.197]) by dpdk.org (Postfix) with ESMTP id 623195953\n for <dev@dpdk.org>; Mon,  9 Nov 2020 12:31:55 +0100 (CET)",
            "from inocybe.home (lfbn-poi-1-1343-16.w90-78.abo.wanadoo.fr\n [90.78.4.16]) (Authenticated sender: grive@u256.net)\n by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id CF8901C0010;\n Mon,  9 Nov 2020 11:31:53 +0000 (UTC)"
        ],
        "X-Originating-IP": "90.78.4.16",
        "From": "Gaetan Rivet <grive@u256.net>",
        "To": "dev@dpdk.org",
        "Cc": "Hemant Agrawal <hemant.agrawal@nxp.com>,\n Sachin Saxena <sachin.saxena@oss.nxp.com>",
        "Date": "Mon,  9 Nov 2020 12:31:47 +0100",
        "Message-Id": "<20201109113147.962882-1-grive@u256.net>",
        "X-Mailer": "git-send-email 2.29.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH] bus/dpaa: optimize device name parsing",
        "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": "Device name parsing is done on all buses during device iterations at\neither EAL or ethdev levels.\n\nWhen a bus implements device name parsing slowly, all iterations are\nimpacted. Efficient implementation is important.\n\nThe DPAA bus device name parsing has two issues: it allocates dynamic\nmemory and uses snprintf without a real need for it. Both can be\navoided, which improves the parsing performance.\n\nThe function is also simpler and shorter.\n\nSigned-off-by: Gaetan Rivet <grive@u256.net>\n---\n drivers/bus/dpaa/dpaa_bus.c | 69 +++++++++++++++----------------------\n 1 file changed, 27 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c\nindex ece6a4c424..014b4ab2ce 100644\n--- a/drivers/bus/dpaa/dpaa_bus.c\n+++ b/drivers/bus/dpaa/dpaa_bus.c\n@@ -385,12 +385,10 @@ dpaa_portal_finish(void *arg)\n }\n \n static int\n-rte_dpaa_bus_parse(const char *name, void *out_name)\n+rte_dpaa_bus_parse(const char *name, void *out)\n {\n-\tint i, j;\n-\tint max_fman = 2, max_macs = 16;\n-\tchar *dup_name;\n-\tchar *sep = NULL;\n+\tunsigned int i, j;\n+\tsize_t delta;\n \n \t/* There are two ways of passing device name, with and without\n \t * separator. \"dpaa_bus:fm1-mac3\" with separator, and \"fm1-mac3\"\n@@ -399,46 +397,33 @@ rte_dpaa_bus_parse(const char *name, void *out_name)\n \t */\n \tDPAA_BUS_DEBUG(\"Parse device name (%s)\", name);\n \n-\t/* Check for dpaa_bus:fm1-mac3 style */\n-\tdup_name = strdup(name);\n-\tsep = strchr(dup_name, ':');\n-\tif (!sep)\n-\t\t/* If not, check for name=fm1-mac3 style */\n-\t\tsep = strchr(dup_name, '=');\n-\n-\tif (sep)\n-\t\t/* jump over the seprator */\n-\t\tsep = (char *) (sep + 1);\n-\telse\n-\t\tsep = dup_name;\n-\n-\tfor (i = 0; i < max_fman; i++) {\n-\t\tfor (j = 0; j < max_macs; j++) {\n-\t\t\tchar fm_name[16];\n-\t\t\tsnprintf(fm_name, 16, \"fm%d-mac%d\", i, j);\n-\t\t\tif (strcmp(fm_name, sep) == 0) {\n-\t\t\t\tif (out_name)\n-\t\t\t\t\tstrcpy(out_name, sep);\n-\t\t\t\tfree(dup_name);\n-\t\t\t\treturn 0;\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\tfor (i = 0; i < RTE_LIBRTE_DPAA_MAX_CRYPTODEV; i++) {\n-\t\tchar sec_name[16];\n-\n-\t\tsnprintf(sec_name, 16, \"dpaa_sec-%d\", i+1);\n-\t\tif (strcmp(sec_name, sep) == 0) {\n-\t\t\tif (out_name)\n-\t\t\t\tstrcpy(out_name, sep);\n-\t\t\tfree(dup_name);\n-\t\t\treturn 0;\n+\tdelta = 0;\n+\tif (strncmp(name, \"dpaa_bus:\", 9) == 0) {\n+\t\tdelta = 9;\n+\t} else if (strncmp(name, \"name=\", 5) == 0) {\n+\t\tdelta = 5;\n+\t}\n+\n+\tif (sscanf(&name[delta], \"fm%u-mac%u\", &i, &j) == 2) {\n+\t\tif (i >= 2 || j >= 16)\n+\t\t\treturn -EINVAL;\n+\t\tif (out != NULL) {\n+\t\t\tchar *out_name = out;\n+\n+\t\t\tif (rte_strscpy(out_name, &name[delta], 10) < 0)\n+\t\t\t\treturn -ENAMETOOLONG;\n+\t\t\t/* Because 'i' can only be 0 or 1, fm%u is fixed size ;\n+\t\t\t * mac%u needs to be checked for optional end ','.\n+\t\t\t */\n+\t\t\tif (out_name[9] == ',')\n+\t\t\t\tout_name[9] = '\\0';\n \t\t}\n+\t\treturn 0;\n+\t} else {\n+\t\treturn -EINVAL;\n \t}\n \n-\tfree(dup_name);\n-\treturn -EINVAL;\n+\treturn -ENODEV;\n }\n \n #define DPAA_DEV_PATH1 \"/sys/devices/platform/soc/soc:fsl,dpaa\"\n",
    "prefixes": []
}