get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7121,
    "url": "https://patches.dpdk.org/api/patches/7121/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443042977-8271-1-git-send-email-rkerur@gmail.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": "<1443042977-8271-1-git-send-email-rkerur@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443042977-8271-1-git-send-email-rkerur@gmail.com",
    "date": "2015-09-23T21:16:17",
    "name": "[dpdk-dev,v3] Change rte_eal_vdev_init to update port_id",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8504716cc91ff9db7dfb184c5d984c9e9b5ee57b",
    "submitter": {
        "id": 134,
        "url": "https://patches.dpdk.org/api/people/134/?format=api",
        "name": "Ravi Kerur",
        "email": "rkerur@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443042977-8271-1-git-send-email-rkerur@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7121/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7121/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id F38F18E68;\n\tWed, 23 Sep 2015 23:16:17 +0200 (CEST)",
            "from mail-pa0-f52.google.com (mail-pa0-f52.google.com\n\t[209.85.220.52]) by dpdk.org (Postfix) with ESMTP id F036E8E66\n\tfor <dev@dpdk.org>; Wed, 23 Sep 2015 23:16:15 +0200 (CEST)",
            "by pacex6 with SMTP id ex6so50871685pac.0\n\tfor <dev@dpdk.org>; Wed, 23 Sep 2015 14:16:15 -0700 (PDT)",
            "from user-PC.hsd1.ca.comcast.net\n\t(c-24-4-155-27.hsd1.ca.comcast.net. [24.4.155.27])\n\tby smtp.gmail.com with ESMTPSA id\n\tdz7sm9713704pab.16.2015.09.23.14.16.14\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 23 Sep 2015 14:16:14 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=iCzI2U3qji5gqh9Vmns0UyjRrVX8aiVA1HtwK70UPN4=;\n\tb=FbBJHzRcwokd822a7iaQ82PZlEm0xjmPnoaeXe+VlgoO0F9aePRfa41xtMHRev+Hr8\n\truhGHlpuw+auIqVPGW4X4exqfiQ2DeIiZXvNqyKvbTsBcAIBeJdIeQFo10YWyDtxOTNW\n\taM5X+ppBlqLbFdf2P3nw19doeQuybDgS9fIvhSEEthOzvBdoyvoGeVThcLhiaggeepyM\n\ttc7u22wFdKR4bjhXqeaGFNJZAg7gAg3QeJRa1JiRFBBVViBUMpZgA2NtDpAfWAJm/rBw\n\tPXuzM/KW4pp0WJQOG2Z+ldm8p/D8v8pbKRjcxkkJduGvsxBQw3cu9DIw9nMktGGvyL1K\n\tgqNA==",
        "X-Received": "by 10.68.245.164 with SMTP id xp4mr39552001pbc.100.1443042975344;\n\tWed, 23 Sep 2015 14:16:15 -0700 (PDT)",
        "From": "Ravi Kerur <rkerur@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 23 Sep 2015 14:16:17 -0700",
        "Message-Id": "<1443042977-8271-1-git-send-email-rkerur@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1443042947-8208-1-git-send-email-rkerur@gmail.com>",
        "References": "<1443042947-8208-1-git-send-email-rkerur@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH v3] Change rte_eal_vdev_init to update port_id",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "v3:\n   > Isolate changes within rte_ether component.\n\nv2:\n   > Remove tilegx changes\n   > Use rte_eal_compare_pci_addr for address comparison\n   > Use dpdk_2.2 in version map file for new functions\n\nv1:\nChanges include\n   > Modify rte_eal_vdev_init to return allocated port_id\n   > Modify rte_eal_probe_one to return allocated port_id\n\n2. Removed following functions\n   > rte_eth_dev_save and\n   > rte_eth_dev_get_changed_port\n\n3. Added 2 new functions\n   > rte_eth_dev_get_port_by_name\n   > rte_eth_dev_get_port_by_addr\n\n4. Fix return error(ENOMEM) in function rte_pmd_mpipe_devinit\n\nCompiled on Linux for following targets\n   > x86_64-native-linuxapp-gcc\n   > x86_64-native-linuxapp-clang\n   > x86_x32-native-linuxapp-gcc\n\nCompiled on FreeBSD for following targets\n   > x86_64-native-bsdapp-clang\n   > x86_64-native-bsdapp-gcc\n\nTested on Linux/FreeBSD:\n   > port attach eth_null\n   > port start all\n   > port stop all\n   > port close all\n   > port detach 0\n   > port attach eth_null\n   > port start all\n   > port stop all\n   > port close all\n   > port detach 0\n\nSuccessful run of checkpatch.pl on the diffs\n\nSuccessful validate_abi on Linux for following targets\n\n   > x86_64-native-linuxapp-gcc\n   > x86_64-native-linuxapp-clang\n\nSigned-off-by: Ravi Kerur <rkerur@gmail.com>\n---\n lib/librte_ether/rte_ethdev.c | 116 +++++++++++++++++++++++-------------------\n 1 file changed, 63 insertions(+), 53 deletions(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex b309309..e4b8e41 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -442,32 +442,6 @@ rte_eth_dev_get_device_type(uint8_t port_id)\n }\n \n static int\n-rte_eth_dev_save(struct rte_eth_dev *devs, size_t size)\n-{\n-\tif ((devs == NULL) ||\n-\t    (size != sizeof(struct rte_eth_dev) * RTE_MAX_ETHPORTS))\n-\t\treturn -EINVAL;\n-\n-\t/* save current rte_eth_devices */\n-\tmemcpy(devs, rte_eth_devices, size);\n-\treturn 0;\n-}\n-\n-static int\n-rte_eth_dev_get_changed_port(struct rte_eth_dev *devs, uint8_t *port_id)\n-{\n-\tif ((devs == NULL) || (port_id == NULL))\n-\t\treturn -EINVAL;\n-\n-\t/* check which port was attached or detached */\n-\tfor (*port_id = 0; *port_id < RTE_MAX_ETHPORTS; (*port_id)++, devs++) {\n-\t\tif (rte_eth_devices[*port_id].attached ^ devs->attached)\n-\t\t\treturn 0;\n-\t}\n-\treturn -ENODEV;\n-}\n-\n-static int\n rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)\n {\n \tVALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n@@ -501,6 +475,59 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)\n }\n \n static int\n+rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)\n+{\n+\tint i;\n+\n+\tif (name == NULL) {\n+\t\tPMD_DEBUG_TRACE(\"Null pointer is specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t*port_id = RTE_MAX_ETHPORTS;\n+\n+\tfor (i = 0; i < RTE_MAX_ETHPORTS; i++) {\n+\n+\t\tif (!strncmp(name,\n+\t\t\trte_eth_dev_data[i].name, strlen(name))) {\n+\n+\t\t\t*port_id = i;\n+\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\treturn -ENODEV;\n+}\n+\n+static int\n+rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)\n+{\n+\tint i;\n+\tstruct rte_pci_device *pci_dev = NULL;\n+\n+\tif (addr == NULL) {\n+\t\tPMD_DEBUG_TRACE(\"Null pointer is specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t*port_id = RTE_MAX_ETHPORTS;\n+\n+\tfor (i = 0; i < RTE_MAX_ETHPORTS; i++) {\n+\n+\t\tpci_dev = rte_eth_devices[i].pci_dev;\n+\n+\t\tif (pci_dev &&\n+\t\t\t!rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {\n+\n+\t\t\t*port_id = i;\n+\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\treturn -ENODEV;\n+}\n+\n+static int\n rte_eth_dev_is_detachable(uint8_t port_id)\n {\n \tuint32_t drv_flags;\n@@ -530,30 +557,19 @@ rte_eth_dev_is_detachable(uint8_t port_id)\n static int\n rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)\n {\n-\tuint8_t new_port_id;\n-\tstruct rte_eth_dev devs[RTE_MAX_ETHPORTS];\n-\n \tif ((addr == NULL) || (port_id == NULL))\n \t\tgoto err;\n \n-\t/* save current port status */\n-\tif (rte_eth_dev_save(devs, sizeof(devs)))\n-\t\tgoto err;\n \t/* re-construct pci_device_list */\n \tif (rte_eal_pci_scan())\n \t\tgoto err;\n-\t/* invoke probe func of the driver can handle the new device.\n-\t * TODO:\n-\t * rte_eal_pci_probe_one() should return port_id.\n-\t * And rte_eth_dev_save() and rte_eth_dev_get_changed_port()\n-\t * should be removed. */\n+\t/* Invoke probe func of the driver can handle the new device. */\n \tif (rte_eal_pci_probe_one(addr))\n \t\tgoto err;\n-\t/* get port_id enabled by above procedures */\n-\tif (rte_eth_dev_get_changed_port(devs, &new_port_id))\n+\n+\tif (rte_eth_dev_get_port_by_addr(addr, port_id))\n \t\tgoto err;\n \n-\t*port_id = new_port_id;\n \treturn 0;\n err:\n \tRTE_LOG(ERR, EAL, \"Driver, cannot attach the device\\n\");\n@@ -600,8 +616,6 @@ static int\n rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)\n {\n \tchar *name = NULL, *args = NULL;\n-\tuint8_t new_port_id;\n-\tstruct rte_eth_dev devs[RTE_MAX_ETHPORTS];\n \tint ret = -1;\n \n \tif ((vdevargs == NULL) || (port_id == NULL))\n@@ -611,22 +625,18 @@ rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)\n \tif (rte_eal_parse_devargs_str(vdevargs, &name, &args))\n \t\tgoto end;\n \n-\t/* save current port status */\n-\tif (rte_eth_dev_save(devs, sizeof(devs)))\n-\t\tgoto end;\n \t/* walk around dev_driver_list to find the driver of the device,\n-\t * then invoke probe function o the driver.\n-\t * TODO:\n-\t * rte_eal_vdev_init() should return port_id,\n-\t * And rte_eth_dev_save() and rte_eth_dev_get_changed_port()\n-\t * should be removed. */\n+\t * then invoke probe function of the driver.\n+\t * rte_eal_vdev_init() updates port_id allocated after\n+\t * initialization.\n+\t */\n \tif (rte_eal_vdev_init(name, args))\n \t\tgoto end;\n-\t/* get port_id enabled by above procedures */\n-\tif (rte_eth_dev_get_changed_port(devs, &new_port_id))\n+\n+\tif (rte_eth_dev_get_port_by_name(name, port_id))\n \t\tgoto end;\n+\n \tret = 0;\n-\t*port_id = new_port_id;\n end:\n \tif (name)\n \t\tfree(name);\n",
    "prefixes": [
        "dpdk-dev",
        "v3"
    ]
}