get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 3612,
    "url": "https://patches.dpdk.org/api/patches/3612/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1424695564-3913-9-git-send-email-mukawa@igel.co.jp/",
    "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": "<1424695564-3913-9-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1424695564-3913-9-git-send-email-mukawa@igel.co.jp",
    "date": "2015-02-23T12:45:57",
    "name": "[dpdk-dev,v12,08/13] ethdev: Add functions that will be used by port hotplug functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4e618c916f07e926b9294df189e784ab857dd919",
    "submitter": {
        "id": 64,
        "url": "https://patches.dpdk.org/api/people/64/?format=api",
        "name": "Tetsuya Mukawa",
        "email": "mukawa@igel.co.jp"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1424695564-3913-9-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/3612/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/3612/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 6CCB5B411;\n\tMon, 23 Feb 2015 13:47:06 +0100 (CET)",
            "from mail-pd0-f179.google.com (mail-pd0-f179.google.com\n\t[209.85.192.179]) by dpdk.org (Postfix) with ESMTP id D16DBADE8\n\tfor <dev@dpdk.org>; Mon, 23 Feb 2015 13:46:54 +0100 (CET)",
            "by pdev10 with SMTP id v10so25131480pde.10\n\tfor <dev@dpdk.org>; Mon, 23 Feb 2015 04:46:54 -0800 (PST)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\tcf12sm10491641pdb.43.2015.02.23.04.46.52\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 23 Feb 2015 04:46:53 -0800 (PST)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=7pKR8nFwlc/sXnBCpqyudOxwgqWuK3CrcVEpRoRl5Kg=;\n\tb=V2DK1Ma1BbSG/PVLr9CaQiG9/I4a4XtHSUYojJlxHKYfH3W/F+hLquy3Qtxlq/RZSq\n\tOI5rX8Q1uBHdFGTdRTTBKNrhLPD0WCXUzXoh27tP2UeqQ2ZLnQk3RrITI++ii6V6PCcC\n\tSG2RbuiEFu439KzqsBoiSnZPk19+C+8Jwr8mCOx5IhgKXDzZHytxMJDyoK4+GWmaAGgS\n\txuTwtrsK6dyPjtDMHl/h94YdSKfJjazXsHdihsENv/zGy3hSvBp7wTRrtTpBGMZDBpBf\n\tRe7quD7Ff4nQkNFno+WM4iZvSRu9pUSpbV1BVQECTtXOEz4UD6RcfYNrV//rqHNiGA3+\n\t4KvQ==",
        "X-Gm-Message-State": "ALoCoQm4xvVho3AfeqXUPhJuM6wF/IUal1GU85e1ooTfkTMrLgPtCdlWMwgWMpt/9Ycn43YNumv2",
        "X-Received": "by 10.70.92.164 with SMTP id cn4mr18511743pdb.110.1424695614274; \n\tMon, 23 Feb 2015 04:46:54 -0800 (PST)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 23 Feb 2015 21:45:57 +0900",
        "Message-Id": "<1424695564-3913-9-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1424695564-3913-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1424060073-23484-2-git-send-email-mukawa@igel.co.jp>\n\t<1424695564-3913-1-git-send-email-mukawa@igel.co.jp>",
        "Subject": "[dpdk-dev] [PATCH v12 08/13] ethdev: Add functions that will be\n\tused by port hotplug functions",
        "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": "The patch adds following functions.\n\n- rte_eth_dev_save()\n  The function is used for saving current rte_eth_dev structures.\n- rte_eth_dev_get_changed_port()\n  The function receives the rte_eth_dev structures, then compare\n  these with current values to know which port is actually\n  attached or detached.\n- rte_eth_dev_get_addr_by_port()\n  The function returns a pci address of an ethdev specified by port\n  identifier.\n- rte_eth_dev_get_port_by_addr()\n  The function returns a port identifier of an ethdev specified by\n  pci address.\n- rte_eth_dev_get_name_by_port()\n  The function returns a unique identifier name of an ethdev\n  specified by port identifier.\n- Add rte_eth_dev_is_detachable()\n  The function returns whether a PMD supports detach function.\n\nAlso, the patch changes scope of rte_eth_dev_allocated() to global.\nThis function will be called by virtual PMDs to support port hotplug.\nSo change scope of the function to global.\n\nv10:\n- Change order of version.map.\n  (Thanks to Thomas Monjalon)\nv9:\n- rte_eth_dev_check_detachable() is replaced by\n  rte_eth_dev_is_detachable().\n- strncpy() is replaced by strcpy().\n  (Thanks to Thomas Monjalon)\n- Add missing symbol in version map.\n  (Thanks to Nail Horman)\nv8:\n- Add size parameter to rte_eth_dev_save().\n- Add missing symbol in version map.\n  (Thanks to Qiu, Michael and Iremonger, Bernard)\nv7:\n- Add pt_driver checking to rte_eth_dev_check_detachable().\n  (Thanks to Qiu, Michael)\nv5:\n- Fix return value of below functions.\n  rte_eth_dev_get_changed_port().\n  rte_eth_dev_get_port_by_addr().\nv4:\n- Add parameter checking.\nv3:\n- Fix if-condition bug while comparing pci addresses.\n- Add error checking codes.\nReported-by: Mark Enright <menrigh@brocade.com>\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_ether/rte_ethdev.c          | 103 ++++++++++++++++++++++++++++++++-\n lib/librte_ether/rte_ethdev.h          |  83 ++++++++++++++++++++++++++\n lib/librte_ether/rte_ether_version.map |   7 +++\n 3 files changed, 192 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 3d148e2..7067620 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -201,7 +201,7 @@ rte_eth_dev_data_alloc(void)\n \t\t\t\tRTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data));\n }\n \n-static struct rte_eth_dev *\n+struct rte_eth_dev *\n rte_eth_dev_allocated(const char *name)\n {\n \tunsigned i;\n@@ -426,6 +426,107 @@ rte_eth_dev_count(void)\n \treturn (nb_ports);\n }\n \n+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+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+int\n+rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)\n+{\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (addr == NULL) {\n+\t\tPMD_DEBUG_TRACE(\"Null pointer is specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t*addr = rte_eth_devices[port_id].pci_dev->addr;\n+\treturn 0;\n+}\n+\n+int\n+rte_eth_dev_get_port_by_addr(struct rte_pci_addr *addr, uint8_t *port_id)\n+{\n+\tstruct rte_pci_addr *tmp;\n+\n+\tif ((addr == NULL) || (port_id == NULL)) {\n+\t\tPMD_DEBUG_TRACE(\"Null pointer is specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (*port_id = 0; *port_id < RTE_MAX_ETHPORTS; (*port_id)++) {\n+\t\tif (!rte_eth_devices[*port_id].attached)\n+\t\t\tcontinue;\n+\t\tif (!rte_eth_devices[*port_id].pci_dev)\n+\t\t\tcontinue;\n+\t\ttmp = &rte_eth_devices[*port_id].pci_dev->addr;\n+\t\tif (rte_eal_compare_pci_addr(tmp, addr) == 0)\n+\t\t\treturn 0;\n+\t}\n+\treturn -ENODEV;\n+}\n+\n+int\n+rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)\n+{\n+\tchar *tmp;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (name == NULL) {\n+\t\tPMD_DEBUG_TRACE(\"Null pointer is specified\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* shouldn't check 'rte_eth_devices[i].data',\n+\t * because it might be overwritten by VDEV PMD */\n+\ttmp = rte_eth_dev_data[port_id].name;\n+\tstrcpy(name, tmp);\n+\treturn 0;\n+}\n+\n+int\n+rte_eth_dev_is_detachable(uint8_t port_id)\n+{\n+\tuint32_t drv_flags;\n+\n+\tif (port_id >= RTE_MAX_ETHPORTS) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tdrv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;\n+\treturn !(drv_flags & RTE_PCI_DRV_DETACHABLE);\n+}\n+\n static int\n rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)\n {\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 6cba06d..d4cfafb 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1476,6 +1476,89 @@ extern struct rte_eth_dev rte_eth_devices[];\n extern uint8_t rte_eth_dev_count(void);\n \n /**\n+ * Function for internal use by port hotplug functions.\n+ * Copies current ethdev structures to the specified pointer.\n+ *\n+ * @param\tdevs\tThe pointer to the ethdev structures\n+ * @param\tsize\tThe size of ethdev structures\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+extern int rte_eth_dev_save(struct rte_eth_dev *devs, size_t size);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Compare the specified ethdev structures with currents. Then\n+ * if there is a port which status is changed, fill the specified pointer\n+ * with the port id of that port.\n+ * @param\tdevs\tThe pointer to the ethdev structures\n+ * @param\tport_id\tThe pointer to the port id\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+extern int rte_eth_dev_get_changed_port(\n+\t\tstruct rte_eth_dev *devs, uint8_t *port_id);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Returns a pci address of a ethdev specified by port identifier.\n+ * @param\tport_id\n+ *   The port identifier of the Ethernet device\n+ * @param\taddr\n+ *   The pointer to the pci address\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+extern int rte_eth_dev_get_addr_by_port(\n+\t\tuint8_t port_id, struct rte_pci_addr *addr);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Returns a port identifier of a ethdev specified by pci address.\n+ * @param\taddr\n+ *   The pointer to the pci address of the Ethernet device.\n+ * @param\tport_id\n+ *   The pointer to the port identifier\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+extern int rte_eth_dev_get_port_by_addr(\n+\t\tstruct rte_pci_addr *addr, uint8_t *port_id);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Returns a unique identifier name of a ethdev specified by port identifier.\n+ * @param\tport_id\n+ *   The port identifier.\n+ * @param\tname\n+ *  The pointer to the Unique identifier name for each Ethernet device\n+ * @return\n+ *   - 0 on success, negative on error\n+ */\n+extern int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Check whether or not, a PMD that is handling the ethdev specified by port\n+ * identifier can support detach function.\n+ * @param\tport_id\n+ *   The port identifier\n+ * @return\n+ *   - 0 on supporting detach function, negative on not supporting\n+ */\n+extern int rte_eth_dev_is_detachable(uint8_t port_id);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n+ * Returns a ethdev slot specified by the unique identifier name.\n+ * @param\tname\n+ *  The pointer to the Unique identifier name for each Ethernet device\n+ * @return\n+ *   - The pointer to the ethdev slot, on success. NULL on error\n+ */\n+extern struct rte_eth_dev *rte_eth_dev_allocated(const char *name);\n+\n+/**\n  * Function for internal use by dummy drivers primarily, e.g. ring-based\n  * driver.\n  * Allocates a new ethdev slot for an ethernet device and returns the pointer\ndiff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map\nindex f66fd2d..099c769 100644\n--- a/lib/librte_ether/rte_ether_version.map\n+++ b/lib/librte_ether/rte_ether_version.map\n@@ -6,6 +6,7 @@ DPDK_2.0 {\n \trte_eth_allmulticast_enable;\n \trte_eth_allmulticast_get;\n \trte_eth_dev_allocate;\n+\trte_eth_dev_allocated;\n \trte_eth_dev_bypass_event_show;\n \trte_eth_dev_bypass_event_store;\n \trte_eth_dev_bypass_init;\n@@ -32,9 +33,14 @@ DPDK_2.0 {\n \trte_eth_dev_filter_supported;\n \trte_eth_dev_flow_ctrl_get;\n \trte_eth_dev_flow_ctrl_set;\n+\trte_eth_dev_get_addr_by_port;\n+\trte_eth_dev_get_changed_port;\n \trte_eth_dev_get_mtu;\n+\trte_eth_dev_get_name_by_port;\n+\trte_eth_dev_get_port_by_addr;\n \trte_eth_dev_get_vlan_offload;\n \trte_eth_dev_info_get;\n+\trte_eth_dev_is_detachable;\n \trte_eth_dev_mac_addr_add;\n \trte_eth_dev_mac_addr_remove;\n \trte_eth_dev_priority_flow_ctrl_set;\n@@ -44,6 +50,7 @@ DPDK_2.0 {\n \trte_eth_dev_rss_reta_update;\n \trte_eth_dev_rx_queue_start;\n \trte_eth_dev_rx_queue_stop;\n+\trte_eth_dev_save;\n \trte_eth_dev_set_link_down;\n \trte_eth_dev_set_link_up;\n \trte_eth_dev_set_mtu;\n",
    "prefixes": [
        "dpdk-dev",
        "v12",
        "08/13"
    ]
}