get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 56430,
    "url": "http://patches.dpdk.org/api/patches/56430/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190715084442.14686-2-hemant.agrawal@nxp.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": "<20190715084442.14686-2-hemant.agrawal@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190715084442.14686-2-hemant.agrawal@nxp.com",
    "date": "2019-07-15T08:44:38",
    "name": "[v3,1/5] bus/fslmc: support device iteration",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6e2736857430caac16e817d56c0cf802ef81bde2",
    "submitter": {
        "id": 477,
        "url": "http://patches.dpdk.org/api/people/477/?format=api",
        "name": "Hemant Agrawal",
        "email": "hemant.agrawal@nxp.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190715084442.14686-2-hemant.agrawal@nxp.com/mbox/",
    "series": [
        {
            "id": 5489,
            "url": "http://patches.dpdk.org/api/series/5489/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5489",
            "date": "2019-07-15T08:44:37",
            "name": "FSLMC bus enchancements",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/5489/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/56430/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/56430/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A8A0037B0;\n\tMon, 15 Jul 2019 10:46:05 +0200 (CEST)",
            "from inva021.nxp.com (inva021.nxp.com [92.121.34.21])\n\tby dpdk.org (Postfix) with ESMTP id 6A9BE3423\n\tfor <dev@dpdk.org>; Mon, 15 Jul 2019 10:46:02 +0200 (CEST)",
            "from inva021.nxp.com (localhost [127.0.0.1])\n\tby inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E6E8A2001A5;\n\tMon, 15 Jul 2019 10:46:01 +0200 (CEST)",
            "from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com\n\t[165.114.16.14])\n\tby inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 9891520021C;\n\tMon, 15 Jul 2019 10:45:59 +0200 (CEST)",
            "from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net\n\t[10.232.133.63])\n\tby invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5691A402D5;\n\tMon, 15 Jul 2019 16:45:56 +0800 (SGT)"
        ],
        "From": "Hemant Agrawal <hemant.agrawal@nxp.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net,\n\tShreyansh Jain <shreyansh.jain@nxp.com>",
        "Date": "Mon, 15 Jul 2019 14:14:38 +0530",
        "Message-Id": "<20190715084442.14686-2-hemant.agrawal@nxp.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190715084442.14686-1-hemant.agrawal@nxp.com>",
        "References": "<20190627093343.5171-2-hemant.agrawal@nxp.com>\n\t<20190715084442.14686-1-hemant.agrawal@nxp.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Subject": "[dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Shreyansh Jain <shreyansh.jain@nxp.com>\n\nRecent (18.11+), devargs structure was changed and so was DPDK port\nusage in applications like OVS. Applications are now allowed to\nplug/unplug ports (eth) using APIs (hotplug) based on device\narguments.\n\nThis patch enables the plug/unplug function (which are dummy for\nFSLMC) and the iterator function for rte_dev_probe() and similar\nAPI support.\n\nSigned-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>\n---\n drivers/bus/fslmc/fslmc_bus.c | 132 +++++++++++++++++++++++++++++-----\n 1 file changed, 116 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c\nindex f6e66d22c..35103d224 100644\n--- a/drivers/bus/fslmc/fslmc_bus.c\n+++ b/drivers/bus/fslmc/fslmc_bus.c\n@@ -230,34 +230,70 @@ rte_fslmc_parse(const char *name, void *addr)\n {\n \tuint16_t dev_id;\n \tchar *t_ptr;\n+\tchar *sep = NULL;\n+\tuint8_t sep_exists = 0;\n \n-\t/* 'name' is expected to contain name of device, for example, dpio.1,\n-\t * dpni.2, etc.\n+\tDPAA2_BUS_DEBUG(\"Parsing dev=(%s)\", name);\n+\n+\t/* There are multiple ways this can be called, with bus:dev, name=dev\n+\t * or just dev. In all cases, the 'addr' is actually a string.\n+\t */\n+\tsep = strchr(name, ':');\n+\tif (!sep) {\n+\t\t/* check for '=' */\n+\t\tsep = strchr(name, '=');\n+\t\tif (!sep)\n+\t\t\tsep_exists = 0;\n+\t\telse\n+\t\t\tsep_exists = 1;\n+\t} else\n+\t\tsep_exists = 1;\n+\n+\t/* Check if starting part if either of 'fslmc:' or 'name=', separator\n+\t * exists.\n \t */\n-\tif (strncmp(\"dpni\", name, 4) &&\n-\t    strncmp(\"dpseci\", name, 6) &&\n-\t    strncmp(\"dpcon\", name, 5) &&\n-\t    strncmp(\"dpbp\", name, 4) &&\n-\t    strncmp(\"dpio\", name, 4) &&\n-\t    strncmp(\"dpci\", name, 4) &&\n-\t    strncmp(\"dpmcp\", name, 5) &&\n-\t    strncmp(\"dpdmai\", name, 6) &&\n-\t    strncmp(\"dpdmux\", name, 6)) {\n-\t\tDPAA2_BUS_DEBUG(\"Unknown or unsupported device (%s)\", name);\n+\tif (sep_exists) {\n+\t\t/* If either of \"fslmc\" or \"name\" are starting part */\n+\t\tif (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),\n+\t\t\t     strlen(RTE_STR(FSLMC_BUS_NAME))) ||\n+\t\t   (!strncmp(name, \"name\", strlen(\"name\")))) {\n+\t\t\tgoto jump_out;\n+\t\t} else {\n+\t\t\tDPAA2_BUS_DEBUG(\"Invalid device for matching (%s).\",\n+\t\t\t\t\tname);\n+\t\t\tgoto err_out;\n+\t\t}\n+\t} else\n+\t\tsep = strdup(name);\n+\n+jump_out:\n+\t/* Validate device name */\n+\tif (strncmp(\"dpni\", sep, 4) &&\n+\t    strncmp(\"dpseci\", sep, 6) &&\n+\t    strncmp(\"dpcon\", sep, 5) &&\n+\t    strncmp(\"dpbp\", sep, 4) &&\n+\t    strncmp(\"dpio\", sep, 4) &&\n+\t    strncmp(\"dpci\", sep, 4) &&\n+\t    strncmp(\"dpmcp\", sep, 5) &&\n+\t    strncmp(\"dpdmai\", sep, 6) &&\n+\t    strncmp(\"dpdmux\", sep, 6)) {\n+\t\tDPAA2_BUS_DEBUG(\"Unknown or unsupported device (%s)\", sep);\n \t\tgoto err_out;\n \t}\n \n-\tt_ptr = strchr(name, '.');\n+\tt_ptr = strchr(sep, '.');\n \tif (!t_ptr || sscanf(t_ptr + 1, \"%hu\", &dev_id) != 1) {\n-\t\tDPAA2_BUS_ERR(\"Missing device id in device name (%s)\", name);\n+\t\tDPAA2_BUS_ERR(\"Missing device id in device name (%s)\", sep);\n \t\tgoto err_out;\n \t}\n \n \tif (addr)\n-\t\tstrcpy(addr, name);\n+\t\tstrcpy(addr, sep);\n \n \treturn 0;\n err_out:\n+\tif (sep)\n+\t\tfree(sep);\n \treturn -EINVAL;\n }\n \n@@ -430,6 +466,13 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,\n \tconst struct rte_dpaa2_device *dstart;\n \tstruct rte_dpaa2_device *dev;\n \n+\tDPAA2_BUS_DEBUG(\"Finding a device named %s\\n\", (const char *)data);\n+\n+\t/* find_device is always called with an opaque object which should be\n+\t * passed along to the 'cmp' function iterating over all device obj\n+\t * on the bus.\n+\t */\n+\n \tif (start != NULL) {\n \t\tdstart = RTE_DEV_TO_FSLMC_CONST(start);\n \t\tdev = TAILQ_NEXT(dstart, next);\n@@ -437,8 +480,11 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,\n \t\tdev = TAILQ_FIRST(&rte_fslmc_bus.device_list);\n \t}\n \twhile (dev != NULL) {\n-\t\tif (cmp(&dev->device, data) == 0)\n+\t\tif (cmp(&dev->device, data) == 0) {\n+\t\t\tDPAA2_BUS_DEBUG(\"Found device (%s)\\n\",\n+\t\t\t\t\tdev->device.name);\n \t\t\treturn &dev->device;\n+\t\t}\n \t\tdev = TAILQ_NEXT(dev, next);\n \t}\n \n@@ -527,6 +573,57 @@ rte_dpaa2_get_iommu_class(void)\n \treturn RTE_IOVA_PA;\n }\n \n+static int\n+fslmc_bus_plug(struct rte_device *dev __rte_unused)\n+{\n+\t/* No operation is performed while plugging the device */\n+\treturn 0;\n+}\n+\n+static int\n+fslmc_bus_unplug(struct rte_device *dev __rte_unused)\n+{\n+\t/* No operation is performed while unplugging the device */\n+\treturn 0;\n+}\n+\n+static void *\n+fslmc_bus_dev_iterate(const void *start, const char *str,\n+\t\t      const struct rte_dev_iterator *it __rte_unused)\n+{\n+\tconst struct rte_dpaa2_device *dstart;\n+\tstruct rte_dpaa2_device *dev;\n+\tchar *dup, *dev_name = NULL;\n+\n+\t/* Expectation is that device would be name=device_name */\n+\tif (strncmp(str, \"name=\", 5) != 0) {\n+\t\tDPAA2_BUS_ERR(\"Invalid device string (%s)\\n\", str);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Now that name=device_name format is available, split */\n+\tdup = strdup(str);\n+\tdev_name = dup + strlen(\"name=\");\n+\n+\tif (start != NULL) {\n+\t\tdstart = RTE_DEV_TO_FSLMC_CONST(start);\n+\t\tdev = TAILQ_NEXT(dstart, next);\n+\t} else {\n+\t\tdev = TAILQ_FIRST(&rte_fslmc_bus.device_list);\n+\t}\n+\n+\twhile (dev != NULL) {\n+\t\tif (strcmp(dev->device.name, dev_name) == 0) {\n+\t\t\tfree(dup);\n+\t\t\treturn &dev->device;\n+\t\t}\n+\t\tdev = TAILQ_NEXT(dev, next);\n+\t}\n+\n+\tfree(dup);\n+\treturn NULL;\n+}\n+\n struct rte_fslmc_bus rte_fslmc_bus = {\n \t.bus = {\n \t\t.scan = rte_fslmc_scan,\n@@ -534,6 +631,9 @@ struct rte_fslmc_bus rte_fslmc_bus = {\n \t\t.parse = rte_fslmc_parse,\n \t\t.find_device = rte_fslmc_find_device,\n \t\t.get_iommu_class = rte_dpaa2_get_iommu_class,\n+\t\t.plug = fslmc_bus_plug,\n+\t\t.unplug = fslmc_bus_unplug,\n+\t\t.dev_iterate = fslmc_bus_dev_iterate,\n \t},\n \t.device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list),\n \t.driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list),\n",
    "prefixes": [
        "v3",
        "1/5"
    ]
}