Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/6156/?format=api
http://patches.dpdk.org/api/patches/6156/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1436264487-8769-2-git-send-email-bernard.iremonger@intel.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": "<1436264487-8769-2-git-send-email-bernard.iremonger@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1436264487-8769-2-git-send-email-bernard.iremonger@intel.com", "date": "2015-07-07T10:21:25", "name": "[dpdk-dev,v4,1/3] bonding: add support for PCI Port Hotplug", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "730b618f33fd8fcf7c16ce65f241ed2ad71d5001", "submitter": { "id": 91, "url": "http://patches.dpdk.org/api/people/91/?format=api", "name": "Iremonger, Bernard", "email": "bernard.iremonger@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1436264487-8769-2-git-send-email-bernard.iremonger@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/6156/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/6156/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 625915A0A;\n\tTue, 7 Jul 2015 12:21:48 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id E0D545A0A\n\tfor <dev@dpdk.org>; Tue, 7 Jul 2015 12:21:46 +0200 (CEST)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP; 07 Jul 2015 03:21:43 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga001.jf.intel.com with ESMTP; 07 Jul 2015 03:21:40 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt67ALdtw025178; Tue, 7 Jul 2015 11:21:39 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id t67ALd7w008821;\n\tTue, 7 Jul 2015 11:21:39 +0100", "(from bairemon@localhost)\n\tby sivswdev01.ir.intel.com with id t67ALdDR008814;\n\tTue, 7 Jul 2015 11:21:39 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.15,422,1432623600\"; d=\"scan'208\";a=\"724240655\"", "From": "Bernard Iremonger <bernard.iremonger@intel.com>", "To": "dev@dpdk.org", "Date": "Tue, 7 Jul 2015 11:21:25 +0100", "Message-Id": "<1436264487-8769-2-git-send-email-bernard.iremonger@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1436264487-8769-1-git-send-email-bernard.iremonger@intel.com>", "References": "<PATCH>\n\t<1436264487-8769-1-git-send-email-bernard.iremonger@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 1/3] bonding: add support for PCI Port Hotplug", "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": "This patch depends on the Port Hotplug Framework.\nIt implements the rte_dev_uninit_t() function for the link bonding pmd.\n\nSigned-off-by: Bernard Iremonger <bernard.iremonger@intel.com>\n---\n drivers/net/bonding/rte_eth_bond.h | 13 +++++-\n drivers/net/bonding/rte_eth_bond_api.c | 75 ++++++++++++++++++---------\n drivers/net/bonding/rte_eth_bond_pmd.c | 23 ++++++++-\n drivers/net/bonding/rte_eth_bond_private.h | 7 ++-\n 4 files changed, 88 insertions(+), 30 deletions(-)", "diff": "diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h\nindex d688fc3..8efbf07 100644\n--- a/drivers/net/bonding/rte_eth_bond.h\n+++ b/drivers/net/bonding/rte_eth_bond.h\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -131,6 +131,17 @@ int\n rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);\n \n /**\n+ * Free a bonded rte_eth_dev device\n+ *\n+ * @param name\t\t\tName of the link bonding device.\n+ *\n+ * @return\n+ *\t0 on success, negative value otherwise\n+ */\n+int\n+rte_eth_bond_free(const char *name);\n+\n+/**\n * Add a rte_eth_dev device as a slave to the bonded device\n *\n * @param bonded_port_id\tPort ID of bonded device.\ndiff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c\nindex d810ec4..9d8da1c 100644\n--- a/drivers/net/bonding/rte_eth_bond_api.c\n+++ b/drivers/net/bonding/rte_eth_bond_api.c\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -192,7 +192,15 @@ number_of_sockets(void)\n \treturn ++sockets;\n }\n \n-const char *driver_name = \"Link Bonding PMD\";\n+const char driver_name[] = \"rte_bond_pmd\";\n+static struct rte_pci_id pci_id_table;\n+\n+static struct eth_driver rte_bond_pmd = {\n+\t.pci_drv = {\n+\t\t.name = driver_name,\n+\t\t.drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE,\n+\t},\n+};\n \n int\n rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n@@ -200,9 +208,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \tstruct rte_pci_device *pci_dev = NULL;\n \tstruct bond_dev_private *internals = NULL;\n \tstruct rte_eth_dev *eth_dev = NULL;\n-\tstruct eth_driver *eth_drv = NULL;\n \tstruct rte_pci_driver *pci_drv = NULL;\n-\tstruct rte_pci_id *pci_id_table = NULL;\n+\n \t/* now do all data allocation - for eth_dev structure, dummy pci driver\n \t * and internal (private) data\n \t */\n@@ -224,26 +231,15 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \t\tgoto err;\n \t}\n \n-\teth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id);\n-\tif (eth_drv == NULL) {\n-\t\tRTE_BOND_LOG(ERR, \"Unable to malloc eth_drv on socket\");\n-\t\tgoto err;\n-\t}\n+\tpci_drv = &rte_bond_pmd.pci_drv;\n \n-\tpci_drv = ð_drv->pci_drv;\n+\tmemset(&pci_id_table, 0, sizeof(pci_id_table));\n+\tpci_id_table.device_id = PCI_ANY_ID;\n+\tpci_id_table.subsystem_device_id = PCI_ANY_ID;\n+\tpci_id_table.vendor_id = PCI_ANY_ID;\n+\tpci_id_table.subsystem_vendor_id = PCI_ANY_ID;\n \n-\tpci_id_table = rte_zmalloc_socket(name, sizeof(*pci_id_table), 0, socket_id);\n-\tif (pci_id_table == NULL) {\n-\t\tRTE_BOND_LOG(ERR, \"Unable to malloc pci_id_table on socket\");\n-\t\tgoto err;\n-\t}\n-\tpci_id_table->device_id = PCI_ANY_ID;\n-\tpci_id_table->subsystem_device_id = PCI_ANY_ID;\n-\tpci_id_table->vendor_id = PCI_ANY_ID;\n-\tpci_id_table->subsystem_vendor_id = PCI_ANY_ID;\n-\n-\tpci_drv->id_table = pci_id_table;\n-\tpci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;\n+\tpci_drv->id_table = &pci_id_table;\n \n \tinternals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);\n \tif (internals == NULL) {\n@@ -262,7 +258,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \tpci_drv->name = driver_name;\n \tpci_dev->driver = pci_drv;\n \n-\teth_dev->driver = eth_drv;\n+\teth_dev->driver = &rte_bond_pmd;\n \teth_dev->data->dev_private = internals;\n \teth_dev->data->nb_rx_queues = (uint16_t)1;\n \teth_dev->data->nb_tx_queues = (uint16_t)1;\n@@ -318,13 +314,42 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \n err:\n \trte_free(pci_dev);\n-\trte_free(pci_id_table);\n-\trte_free(eth_drv);\n \trte_free(internals);\n+\trte_free(eth_dev->data->mac_addrs);\n \n \treturn -1;\n }\n \n+int\n+rte_eth_bond_free(const char *name)\n+{\n+\tstruct rte_eth_dev *eth_dev = NULL;\n+\n+\t/* now free all data allocation - for eth_dev structure,\n+\t * dummy pci driver and internal (private) data\n+\t */\n+\n+\t/* find an ethdev entry */\n+\teth_dev = rte_eth_dev_allocated(name);\n+\tif (eth_dev == NULL)\n+\t\treturn -ENODEV;\n+\n+\tif (eth_dev->data->dev_started == 1)\n+\t\tbond_ethdev_stop(eth_dev);\n+\n+\teth_dev->dev_ops = NULL;\n+\teth_dev->rx_pkt_burst = NULL;\n+\teth_dev->tx_pkt_burst = NULL;\n+\n+\trte_free(eth_dev->pci_dev);\n+\trte_free(eth_dev->data->dev_private);\n+\trte_free(eth_dev->data->mac_addrs);\n+\n+\trte_eth_dev_release_port(eth_dev);\n+\n+\treturn 0;\n+}\n+\n static int\n __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n {\ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex 989e878..a2eecb9 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -1512,7 +1512,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)\n \treturn 0;\n }\n \n-static void\n+void\n bond_ethdev_stop(struct rte_eth_dev *eth_dev)\n {\n \tstruct bond_dev_private *internals = eth_dev->data->dev_private;\n@@ -2043,6 +2043,24 @@ parse_error:\n \treturn -1;\n }\n \n+static int\n+bond_uninit(const char *name)\n+{\n+\tint ret;\n+\n+\tif (name == NULL)\n+\t\treturn -EINVAL;\n+\n+\tRTE_LOG(INFO, EAL, \"Uninitializing pmd_bond for %s\\n\", name);\n+\n+\t/* free link bonding eth device */\n+\tret = rte_eth_bond_free(name);\n+\tif (ret < 0)\n+\t\tRTE_LOG(ERR, EAL, \"Failed to free %s\\n\", name);\n+\n+\treturn ret;\n+}\n+\n /* this part will resolve the slave portids after all the other pdev and vdev\n * have been allocated */\n static int\n@@ -2269,6 +2287,7 @@ static struct rte_driver bond_drv = {\n \t.name = \"eth_bond\",\n \t.type = PMD_VDEV,\n \t.init = bond_init,\n+\t.uninit = bond_uninit,\n };\n \n PMD_REGISTER_DRIVER(bond_drv);\ndiff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h\nindex 45e5c65..7b00e94 100644\n--- a/drivers/net/bonding/rte_eth_bond_private.h\n+++ b/drivers/net/bonding/rte_eth_bond_private.h\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -62,7 +62,7 @@\n \n extern const char *pmd_bond_init_valid_arguments[];\n \n-extern const char *driver_name;\n+extern const char driver_name[];\n \n /** Port Queue Mapping Structure */\n struct bond_rx_queue {\n@@ -284,4 +284,7 @@ bond_tlb_enable(struct bond_dev_private *internals);\n void\n bond_tlb_activate_slave(struct bond_dev_private *internals);\n \n+void\n+bond_ethdev_stop(struct rte_eth_dev *eth_dev);\n+\n #endif\n", "prefixes": [ "dpdk-dev", "v4", "1/3" ] }{ "id": 6156, "url": "