Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2369/?format=api
https://patches.dpdk.org/api/patches/2369/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421664027-17971-5-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": "<1421664027-17971-5-git-send-email-mukawa@igel.co.jp>", "list_archive_url": "https://inbox.dpdk.org/dev/1421664027-17971-5-git-send-email-mukawa@igel.co.jp", "date": "2015-01-19T10:40:20", "name": "[dpdk-dev,v4,04/11] eal, ethdev: Add a function and function pointers to close ether device", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "feea898fd230c33ba71f86d4c6c9701e4599a96d", "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/1421664027-17971-5-git-send-email-mukawa@igel.co.jp/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/2369/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/2369/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 2E56E5ABB;\n\tMon, 19 Jan 2015 11:41:25 +0100 (CET)", "from mail-pd0-f174.google.com (mail-pd0-f174.google.com\n\t[209.85.192.174]) by dpdk.org (Postfix) with ESMTP id 6D4615A9B\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 11:41:17 +0100 (CET)", "by mail-pd0-f174.google.com with SMTP id ft15so6745900pdb.5\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 02:41:15 -0800 (PST)", "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\ta13sm11337588pdm.44.2015.01.19.02.41.13\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 19 Jan 2015 02:41:14 -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=g2JeVkZ7ChKZUMYGFHOMjKGCg+42PRmBRgKxWqRGGkY=;\n\tb=nL2/7NQqpDRX2Y8Ck76pF72gkPFhh39XIYa9NmQ3nU0VUtC0C3vuKuOSTuCQPt7cwV\n\tDbAIoIPZkaFxJ8hdAf/+XZA42FBbYk/dOfhOVjzf7NLXlqvAR67W9msjnOgv00ZpGt/8\n\tKbeoBGMIMrKwIB0aZ13eU07DF8gdV9oJrAtH4MlEn5qCL1GzNZmFj+NqWNnpjjq73fgl\n\t67RmKA9hIWmiGYEtXQ1b0/vmTyP769osjuAUKNwIsFplKTeQEEwEkCUIZ3259af36mg8\n\tz8K3V/shXKcxFQgOq4VjINfYoEzOoRhKa9IA11DcsfmefvoL/5THkPOjK+N7ahy68zDj\n\t+EAQ==", "X-Gm-Message-State": "ALoCoQkbi6l0cGki0IADvkVFc6z4vlnkgAx4PACwdi1ZfB5x+bt4FpH+gD7RxyAiVirO7tk/sQUB", "X-Received": "by 10.68.189.105 with SMTP id gh9mr42846849pbc.142.1421664075237;\n\tMon, 19 Jan 2015 02:41:15 -0800 (PST)", "From": "Tetsuya Mukawa <mukawa@igel.co.jp>", "To": "dev@dpdk.org", "Date": "Mon, 19 Jan 2015 19:40:20 +0900", "Message-Id": "<1421664027-17971-5-git-send-email-mukawa@igel.co.jp>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>", "References": "<1418106629-22227-2-git-send-email-mukawa@igel.co.j>\n\t<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>", "Subject": "[dpdk-dev] [PATCH v4 04/11] eal,\n\tethdev: Add a function and function pointers to close ether device", "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 function pointer to rte_pci_driver and eth_driver\nstructure. These function pointers are used when ports are detached.\nAlso the patch adds rte_eth_dev_uninit(). So far, it's not called\nby anywhere, but it will be called when port hotplug function is\nimplemented.\n\nv4:\n- Add paramerter checking.\n- Change function names.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_eal/common/include/rte_pci.h | 7 ++++++\n lib/librte_ether/rte_ethdev.c | 40 +++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.h | 24 ++++++++++++++++++++\n 3 files changed, 71 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 128b2ce..fe57cb6 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -181,12 +181,19 @@ struct rte_pci_driver;\n typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *);\n \n /**\n+ * Uninitialisation function for the driver called during hotplugging.\n+ */\n+typedef int (pci_devuninit_t)(\n+\t\tstruct rte_pci_driver *, struct rte_pci_device *);\n+\n+/**\n * A structure describing a PCI driver.\n */\n struct rte_pci_driver {\n \tTAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */\n \tconst char *name; /**< Driver name. */\n \tpci_devinit_t *devinit; /**< Device init. function. */\n+\tpci_devuninit_t *devuninit; /**< Device uninit function. */\n \tstruct rte_pci_id *id_table; /**< ID table, NULL terminated. */\n \tuint32_t drv_flags; /**< Flags contolling handling of device. */\n };\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 16f22c0..e5145b7 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -335,6 +335,45 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,\n \treturn diag;\n }\n \n+static int\n+rte_eth_dev_uninit(struct rte_pci_driver *pci_drv,\n+\t\t struct rte_pci_device *pci_dev)\n+{\n+\tstruct eth_driver *eth_drv;\n+\tstruct rte_eth_dev *eth_dev;\n+\tchar ethdev_name[RTE_ETH_NAME_MAX_LEN];\n+\n+\tif ((pci_drv == NULL) || (pci_dev == NULL))\n+\t\treturn -EINVAL;\n+\n+\t/* Create unique Ethernet device name using PCI address */\n+\tsnprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, \"%d:%d.%d\",\n+\t\t\tpci_dev->addr.bus, pci_dev->addr.devid,\n+\t\t\tpci_dev->addr.function);\n+\n+\teth_dev = rte_eth_dev_free(ethdev_name);\n+\tif (eth_dev == NULL)\n+\t\treturn -ENODEV;\n+\n+\teth_drv = (struct eth_driver *)pci_drv;\n+\n+\t/* Invoke PMD device uninit function */\n+\tif (*eth_drv->eth_dev_uninit)\n+\t\t(*eth_drv->eth_dev_uninit)(eth_drv, eth_dev);\n+\n+\t/* init user callbacks */\n+\tTAILQ_INIT(&(eth_dev->callbacks));\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\trte_free(eth_dev->data->dev_private);\n+\n+\teth_dev->pci_dev = NULL;\n+\teth_dev->driver = NULL;\n+\teth_dev->data = NULL;\n+\n+\treturn 0;\n+}\n+\n /**\n * Register an Ethernet [Poll Mode] driver.\n *\n@@ -353,6 +392,7 @@ void\n rte_eth_driver_register(struct eth_driver *eth_drv)\n {\n \teth_drv->pci_drv.devinit = rte_eth_dev_init;\n+\teth_drv->pci_drv.devuninit = rte_eth_dev_uninit;\n \trte_eal_pci_register(ð_drv->pci_drv);\n }\n \ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex fe64c78..2a8ff26 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1701,6 +1701,27 @@ typedef int (*eth_dev_init_t)(struct eth_driver *eth_drv,\n \n /**\n * @internal\n+ * Finalization function of an Ethernet driver invoked for each matching\n+ * Ethernet PCI device detected during the PCI closing phase.\n+ *\n+ * @param eth_drv\n+ * The pointer to the [matching] Ethernet driver structure supplied by\n+ * the PMD when it registered itself.\n+ * @param eth_dev\n+ * The *eth_dev* pointer is the address of the *rte_eth_dev* structure\n+ * associated with the matching device and which have been [automatically]\n+ * allocated in the *rte_eth_devices* array.\n+ * @return\n+ * - 0: Success, the device is properly finalized by the driver.\n+ * In particular, the driver MUST free the *dev_ops* pointer\n+ * of the *eth_dev* structure.\n+ * - <0: Error code of the device initialization failure.\n+ */\n+typedef int (*eth_dev_uninit_t)(struct eth_driver *eth_drv,\n+\t\t\t\t struct rte_eth_dev *eth_dev);\n+\n+/**\n+ * @internal\n * The structure associated with a PMD Ethernet driver.\n *\n * Each Ethernet driver acts as a PCI driver and is represented by a generic\n@@ -1710,11 +1731,14 @@ typedef int (*eth_dev_init_t)(struct eth_driver *eth_drv,\n *\n * - The *eth_dev_init* function invoked for each matching PCI device.\n *\n+ * - The *eth_dev_uninit* function invoked for each matching PCI device.\n+ *\n * - The size of the private data to allocate for each matching device.\n */\n struct eth_driver {\n \tstruct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */\n \teth_dev_init_t eth_dev_init; /**< Device init function. */\n+\teth_dev_uninit_t eth_dev_uninit; /**< Device uninit function. */\n \tunsigned int dev_private_size; /**< Size of device private data. */\n };\n \n", "prefixes": [ "dpdk-dev", "v4", "04/11" ] }{ "id": 2369, "url": "