Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1379/?format=api
https://patches.dpdk.org/api/patches/1379/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416474399-16851-17-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": "<1416474399-16851-17-git-send-email-mukawa@igel.co.jp>", "list_archive_url": "https://inbox.dpdk.org/dev/1416474399-16851-17-git-send-email-mukawa@igel.co.jp", "date": "2014-11-20T09:06:30", "name": "[dpdk-dev,16/25] eal/pci: Add port hotplug functions for virtual devices.", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "967ddd84055c996701ca25826b0f225e99d649d0", "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/1416474399-16851-17-git-send-email-mukawa@igel.co.jp/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/1379/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/1379/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 3D4E67FA4;\n\tThu, 20 Nov 2014 09:57:31 +0100 (CET)", "from mail-pd0-f176.google.com (mail-pd0-f176.google.com\n\t[209.85.192.176]) by dpdk.org (Postfix) with ESMTP id 1992F7FA4\n\tfor <dev@dpdk.org>; Thu, 20 Nov 2014 09:57:28 +0100 (CET)", "by mail-pd0-f176.google.com with SMTP id y10so2693790pdj.21\n\tfor <dev@dpdk.org>; Thu, 20 Nov 2014 01:07:56 -0800 (PST)", "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\ta6sm1432407pbu.64.2014.11.20.01.07.54 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 20 Nov 2014 01:07:56 -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=o8VlmeirWW55m3m5ei2+hNphCsqtOCh/+KctSOhy4Qw=;\n\tb=A8rSALqIj2XFGWtviugiJsa6d67YXmODsFIVcSctCC7F8aXhRaH/SxicJW/KgpCV3f\n\tNXYUO/RaAgdTEjMMqmw2fyiLvr0v13DDEB/ljKBzqGdcsTwOPw3h+kpdlh+5x8Q5UjW5\n\t0dTougotBdOA+dU04OrIvFf+ubgOkJcf5OctGh/2SVoWyHpj1HT133Sn97qigu54Abmk\n\tzbVtdF04PvuySYp9wZFx37J5SgRHDtRdlkOBj9Unom8giwsJi9Fk08wgVs+DmryaSOVM\n\t7qYyFugcbkNBfuOkDuLxE6NLAqHBjn82PjHeP3lit/cMrSuo33Iqg18ui37EU8hAyqkz\n\tz10Q==", "X-Gm-Message-State": "ALoCoQng5aZFfMgbOODDTQxuREsXDFW047rsy8OnhprLhkYbrZVz+pWMOLq9Be0KHeJPnkLJw3QE", "X-Received": "by 10.70.118.165 with SMTP id kn5mr27786432pdb.140.1416474476850;\n\tThu, 20 Nov 2014 01:07:56 -0800 (PST)", "From": "Tetsuya Mukawa <mukawa@igel.co.jp>", "To": "dev@dpdk.org", "Date": "Thu, 20 Nov 2014 18:06:30 +0900", "Message-Id": "<1416474399-16851-17-git-send-email-mukawa@igel.co.jp>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1416474399-16851-1-git-send-email-mukawa@igel.co.jp>", "References": "<1414572576-21371-1-git-send-email-mukawa@igel.co.jp>\n\t<1416474399-16851-1-git-send-email-mukawa@igel.co.jp>", "Cc": "nakajima.yoshihiro@lab.ntt.co.jp, menrigh@brocade.com,\n\tmasutani.hitoshi@lab.ntt.co.jp", "Subject": "[dpdk-dev] [PATCH 16/25] eal/pci: Add port hotplug functions for\n\tvirtual devices.", "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 rte_eal_dev_attach_vdev() and rte_eal_dev_detach_vdev().\n\nrte_eal_dev_attach_vdev() receives virtual device name and parameters,\nand returns an attached port number.\nrte_eal_dev_detach_vdev() receives a port number, and returns device\nname actually detached.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_eal/common/eal_common_dev.c | 76 +++++++++++++++++++++++++++++++++\n lib/librte_eal/common/include/rte_dev.h | 29 +++++++++++++\n 2 files changed, 105 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c\nindex 183d65b..0518e3c 100644\n--- a/lib/librte_eal/common/eal_common_dev.c\n+++ b/lib/librte_eal/common/eal_common_dev.c\n@@ -180,4 +180,80 @@ rte_eal_dev_close_one(const char *name)\n {\n \treturn rte_eal_dev_find_and_invoke(name, INVOKE_CLOSE);\n }\n+\n+static void\n+get_vdev_name(char *vdevargs)\n+{\n+\tchar *sep;\n+\n+\t/* set the first ',' to '\\0' to split name and arguments */\n+\tsep = strchr(vdevargs, ',');\n+\tif (sep != NULL)\n+\t\tsep[0] = '\\0';\n+}\n+\n+/* attach the new virtual device, then store port_id of the device */\n+int\n+rte_eal_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)\n+{\n+\tchar *args;\n+\tuint8_t new_port_id;\n+\tstruct rte_eth_dev devs[RTE_MAX_ETHPORTS];\n+\n+\targs = strdup(vdevargs);\n+\tif (args == NULL)\n+\t\treturn -1;\n+\n+\t/* save current port status */\n+\trte_eth_dev_save(devs);\n+\t/* add the vdevargs to devargs_list */\n+\tif (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, args))\n+\t\tgoto err0;\n+\t/* parse vdevargs, then retrieve device name */\n+\tget_vdev_name(args);\n+\t/* walk around dev_driver_list to find the driver of the device,\n+\t * then invoke probe function o the driver */\n+\tif (rte_eal_dev_init_one(args))\n+\t\tgoto err1;\n+\t/* get port_id enabled by above procedures */\n+\tif (rte_eth_dev_get_changed_port(devs, &new_port_id))\n+\t\tgoto err1;\n+\n+\tfree(args);\n+\t*port_id = new_port_id;\n+\treturn 0;\n+err1:\n+\trte_eal_devargs_remove(RTE_DEVTYPE_VIRTUAL, args);\n+err0:\n+\tRTE_LOG(ERR, EAL, \"Drver, cannot detach the device\\n\");\n+\tfree(args);\n+\treturn -1;\n+}\n+\n+/* detach the new virtual device, then store the name of the device */\n+int\n+rte_eal_dev_detach_vdev(uint8_t port_id, char *vdevname)\n+{\n+\tchar name[RTE_ETH_NAME_MAX_LEN];\n+\n+\t/* check whether the driver supports detach feature, or not */\n+\tif (!rte_eth_dev_check_detachable(port_id))\n+\t\tgoto err;\n+\n+\t/* get device name by port id */\n+\tif (rte_eth_dev_get_name_by_port(port_id, name))\n+\t\tgoto err;\n+\t/* walk around dev_driver_list to find the driver of the device,\n+\t * then invoke close function o the driver */\n+\tif (rte_eal_dev_close_one(name))\n+\t\tgoto err;\n+\t/* remove the vdevname from devargs_list */\n+\trte_eal_devargs_remove(RTE_DEVTYPE_VIRTUAL, name);\n+\n+\tstrncpy(vdevname, name, sizeof(name));\n+\treturn 0;\n+err:\n+\tRTE_LOG(ERR, EAL, \"Drver, cannot detach the device\\n\");\n+\treturn -1;\n+}\n #endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\ndiff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h\nindex 71d40c3..159d5a5 100644\n--- a/lib/librte_eal/common/include/rte_dev.h\n+++ b/lib/librte_eal/common/include/rte_dev.h\n@@ -98,6 +98,35 @@ void rte_eal_driver_register(struct rte_driver *driver);\n */\n void rte_eal_driver_unregister(struct rte_driver *driver);\n \n+#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP)\n+\n+/**\n+ * Attach a new virtual device.\n+ *\n+ * @param vdevargs\n+ * A pointer to a strings array describing the new device\n+ * to be attached.\n+ * @param port_id\n+ * A pointer to a port identifier actually attached.\n+ * @return\n+ * 0 on success and port_id is filled, negative on error\n+ */\n+int rte_eal_dev_attach_vdev(const char *vdevargs, uint8_t *port_id);\n+\n+/**\n+ * Detach a virtual device.\n+ *\n+ * @param port_id\n+ * The port identifier of the virtual device to detach.\n+ * @param addr\n+ * A pointer to a virtual device name actually detached.\n+ * @return\n+ * 0 on success and vdevname is filled, negative on error\n+ */\n+int rte_eal_dev_detach_vdev(uint8_t port_id, char *vdevname);\n+\n+#endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */\n+\n /**\n * Initalize all the registered drivers in this process\n */\n", "prefixes": [ "dpdk-dev", "16/25" ] }{ "id": 1379, "url": "