Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/19765/?format=api
http://patchwork.dpdk.org/api/patches/19765/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1484801117-779-10-git-send-email-thomas.monjalon@6wind.com/", "project": { "id": 1, "url": "http://patchwork.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": "<1484801117-779-10-git-send-email-thomas.monjalon@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1484801117-779-10-git-send-email-thomas.monjalon@6wind.com", "date": "2017-01-19T04:45:13", "name": "[dpdk-dev,v11,09/13] pci: add bus driver", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "eb77c5245f4aafe7a7b98afe25fbb640311f1e6f", "submitter": { "id": 1, "url": "http://patchwork.dpdk.org/api/people/1/?format=api", "name": "Thomas Monjalon", "email": "thomas.monjalon@6wind.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1484801117-779-10-git-send-email-thomas.monjalon@6wind.com/mbox/", "series": [], "comments": "http://patchwork.dpdk.org/api/patches/19765/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/19765/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 1D90CFB5A;\n\tThu, 19 Jan 2017 05:45:54 +0100 (CET)", "from mail-wm0-f52.google.com (mail-wm0-f52.google.com\n\t[74.125.82.52]) by dpdk.org (Postfix) with ESMTP id C4DD5FB2F\n\tfor <dev@dpdk.org>; Thu, 19 Jan 2017 05:45:31 +0100 (CET)", "by mail-wm0-f52.google.com with SMTP id r144so58582265wme.1\n\tfor <dev@dpdk.org>; Wed, 18 Jan 2017 20:45:31 -0800 (PST)", "from XPS13.localdomain (184.203.134.77.rev.sfr.net.\n\t[77.134.203.184]) by smtp.gmail.com with ESMTPSA id\n\tt194sm2568586wmd.1.2017.01.18.20.45.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 18 Jan 2017 20:45:30 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=URtmZYtc1y/K8dGXXSWNs2FkGEMTa4AUlPfcj3WQMbM=;\n\tb=xLikQlSNe3IaRE5D6nugQcqhr7lR9VHy9UNntITubGB5MhXZBZSYGOZwR+6NQFzqnf\n\tSTdwFyOYTYlcF1rQ+N/94/HmRgTSEyWwAxfhzOLObTFu45Lc8cIvEVYgXD5pCVu4yg9P\n\tHlJ9zD9L2OIukCodaHB0XUcYRSH6/ThP2JEwOLbP8KuqBmrC0b00q6dTlKmi/PeX7uGD\n\tK9MSxCiYquIIVSFeSJFZH+Kt2cWiz1GLP5Akr87yuyJczu6kEPv3TBvegaV4VfcL1Bn8\n\thpUz6tPpm7/HylklAz/VmjocyXjnnCVb7QLs+MsC1HnWpZgJz/MuezGMG6sFzlD0T+Q7\n\t0+6Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=URtmZYtc1y/K8dGXXSWNs2FkGEMTa4AUlPfcj3WQMbM=;\n\tb=D81PoDEWUjbLUFeogHY1wA7rPh8/qeNN0JrZHfZMLqClslN+/G817Ej8u59+use8Mi\n\tvgDXpAIwx85pxJnKuSLqu6DRPaMsyRzUiyUmXjzwWG633Qvj/emeWAoGMRGuMQLt49bK\n\tiGxP0hR62o+tatsPyTMdS0Aai0G/8VM1j719wLp6gJYXT85QBNZ2kS/dNXGwTLOqYS0N\n\tUROKeEU1KyKU88BWc/UR6DUy+F1Ig86u1kZ/EdHxcsRQ+6o7aLTctimf5qOvruxnp0qt\n\tm2i+uskkXqyt5wfQCSyO2lPblFdc+KlkLeoOgHUhEGcxq4kHlhwE4xpxwX9gbsMJVaBm\n\tLPmA==", "X-Gm-Message-State": "AIkVDXItL+Latw8HmRm8nOYvUZI0mciQ2cs/E5MRRqnSTjRvAo+yzixN6zhbx46YViI2+JRq", "X-Received": "by 10.28.54.90 with SMTP id d87mr24322821wma.89.1484801131413;\n\tWed, 18 Jan 2017 20:45:31 -0800 (PST)", "From": "Thomas Monjalon <thomas.monjalon@6wind.com>", "To": "Shreyansh Jain <shreyansh.jain@nxp.com>", "Cc": "dev@dpdk.org", "Date": "Thu, 19 Jan 2017 05:45:13 +0100", "Message-Id": "<1484801117-779-10-git-send-email-thomas.monjalon@6wind.com>", "X-Mailer": "git-send-email 2.7.0", "In-Reply-To": "<1484801117-779-1-git-send-email-thomas.monjalon@6wind.com>", "References": "<1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com>\n\t<1484801117-779-1-git-send-email-thomas.monjalon@6wind.com>", "Subject": "[dpdk-dev] [PATCH v11 09/13] pci: add bus driver", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <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": "From: Shreyansh Jain <shreyansh.jain@nxp.com>\n\nBased on EAL Bus APIs, PCI bus callbacks and support functions are\nintroduced in this patch.\n\nEAL continues to have direct PCI init/scan calls as well. These would be\nremoved in subsequent patches to enable bus only PCI devices.\n\nSigned-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>\nReviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c | 1 +\n lib/librte_eal/bsdapp/eal/eal_pci.c | 11 ++++++\n lib/librte_eal/common/eal_common_pci.c | 25 +++++++++++++\n lib/librte_eal/common/include/rte_pci.h | 65 +++++++++++++++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci.c | 12 ++++++\n 5 files changed, 114 insertions(+)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 534aeea..ee7c9de 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -64,6 +64,7 @@\n #include <rte_string_fns.h>\n #include <rte_cpuflags.h>\n #include <rte_interrupts.h>\n+#include <rte_bus.h>\n #include <rte_pci.h>\n #include <rte_dev.h>\n #include <rte_devargs.h>\ndiff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c\nindex 3a5c315..48bfe24 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_pci.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c\n@@ -673,3 +673,14 @@ rte_eal_pci_init(void)\n \t}\n \treturn 0;\n }\n+\n+struct rte_pci_bus rte_pci_bus = {\n+\t.bus = {\n+\t\t.scan = rte_eal_pci_scan,\n+\t\t.probe = rte_eal_pci_probe,\n+\t},\n+\t.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),\n+\t.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),\n+};\n+\n+RTE_REGISTER_BUS(PCI_BUS_NAME, rte_pci_bus.bus);\ndiff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c\nindex 8b4ae2d..c53e2bd 100644\n--- a/lib/librte_eal/common/eal_common_pci.c\n+++ b/lib/librte_eal/common/eal_common_pci.c\n@@ -71,6 +71,7 @@\n \n #include <rte_interrupts.h>\n #include <rte_log.h>\n+#include <rte_bus.h>\n #include <rte_pci.h>\n #include <rte_per_lcore.h>\n #include <rte_memory.h>\n@@ -87,6 +88,8 @@ struct pci_driver_list pci_driver_list =\n struct pci_device_list pci_device_list =\n \tTAILQ_HEAD_INITIALIZER(pci_device_list);\n \n+extern struct rte_pci_bus rte_pci_bus;\n+\n #define SYSFS_PCI_DEVICES \"/sys/bus/pci/devices\"\n \n const char *pci_get_sysfs_path(void)\n@@ -479,3 +482,25 @@ rte_eal_pci_unregister(struct rte_pci_driver *driver)\n \trte_eal_driver_unregister(&driver->driver);\n \tTAILQ_REMOVE(&pci_driver_list, driver, next);\n }\n+\n+/* Add a device to PCI bus */\n+void\n+rte_eal_pci_add_device(struct rte_pci_device *pci_dev)\n+{\n+\tTAILQ_INSERT_TAIL(&rte_pci_bus.device_list, pci_dev, next);\n+}\n+\n+/* Insert a device into a predefined position in PCI bus */\n+void\n+rte_eal_pci_insert_device(struct rte_pci_device *exist_pci_dev,\n+\t\t\t struct rte_pci_device *new_pci_dev)\n+{\n+\tTAILQ_INSERT_BEFORE(exist_pci_dev, new_pci_dev, next);\n+}\n+\n+/* Remove a device from PCI bus */\n+void\n+rte_eal_pci_remove_device(struct rte_pci_device *pci_dev)\n+{\n+\tTAILQ_REMOVE(&rte_pci_bus.device_list, pci_dev, next);\n+}\ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex adc20b9..957cddb 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -85,6 +85,7 @@ extern \"C\" {\n #include <rte_debug.h>\n #include <rte_interrupts.h>\n #include <rte_dev.h>\n+#include <rte_bus.h>\n \n TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */\n TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */\n@@ -111,6 +112,25 @@ const char *pci_get_sysfs_path(void);\n /** Maximum number of PCI resources. */\n #define PCI_MAX_RESOURCE 6\n \n+/** Name of PCI Bus */\n+#define PCI_BUS_NAME \"PCI\"\n+\n+/* Forward declarations */\n+struct rte_pci_device;\n+struct rte_pci_driver;\n+\n+/** List of PCI devices */\n+TAILQ_HEAD(rte_pci_device_list, rte_pci_device);\n+/** List of PCI drivers */\n+TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);\n+\n+/* PCI Bus iterators */\n+#define FOREACH_DEVICE_ON_PCIBUS(p)\t\\\n+\t\tTAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)\n+\n+#define FOREACH_DRIVER_ON_PCIBUS(p)\t\\\n+\t\tTAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)\n+\n /**\n * A structure describing an ID for a PCI driver. Each driver provides a\n * table of these IDs for each device that it supports.\n@@ -206,12 +226,22 @@ typedef int (pci_remove_t)(struct rte_pci_device *);\n struct rte_pci_driver {\n \tTAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */\n \tstruct rte_driver driver; /**< Inherit core driver. */\n+\tstruct rte_pci_bus *bus; /**< PCI bus reference. */\n \tpci_probe_t *probe; /**< Device Probe function. */\n \tpci_remove_t *remove; /**< Device Remove function. */\n \tconst struct rte_pci_id *id_table;\t/**< ID table, NULL terminated. */\n \tuint32_t drv_flags; /**< Flags contolling handling of device. */\n };\n \n+/**\n+ * Structure describing the PCI bus\n+ */\n+struct rte_pci_bus {\n+\tstruct rte_bus bus; /**< Inherit the generic class */\n+\tstruct rte_pci_device_list device_list; /**< List of PCI devices */\n+\tstruct rte_pci_driver_list driver_list; /**< List of PCI drivers */\n+};\n+\n /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */\n #define RTE_PCI_DRV_NEED_MAPPING 0x0001\n /** Device driver supports link state interrupt */\n@@ -523,6 +553,41 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__)\n void rte_eal_pci_unregister(struct rte_pci_driver *driver);\n \n /**\n+ * Add a PCI device to the PCI Bus (append to PCI Device list). This function\n+ * also updates the bus references of the PCI Device (and the generic device\n+ * object embedded within.\n+ *\n+ * @param pci_dev\n+ *\tPCI device to add\n+ * @return void\n+ */\n+void rte_eal_pci_add_device(struct rte_pci_device *pci_dev);\n+\n+/**\n+ * Insert a PCI device in the PCI Bus at a particular location in the device\n+ * list. It also updates the PCI Bus reference of the new devices to be\n+ * inserted.\n+ *\n+ * @param exist_pci_dev\n+ *\tExisting PCI device in PCI Bus\n+ * @param new_pci_dev\n+ *\tPCI device to be added before exist_pci_dev\n+ * @return void\n+ */\n+void rte_eal_pci_insert_device(struct rte_pci_device *exist_pci_dev,\n+\t\t\t struct rte_pci_device *new_pci_dev);\n+\n+/**\n+ * Remove a PCI device from the PCI Bus. This sets to NULL the bus references\n+ * in the PCI device object as well as the generic device object.\n+ *\n+ * @param pci_device\n+ *\tPCI device to be removed from PCI Bus\n+ * @return void\n+ */\n+void rte_eal_pci_remove_device(struct rte_pci_device *pci_device);\n+\n+/**\n * Read PCI config space.\n *\n * @param device\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex e2fc219..c40814d 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -35,6 +35,7 @@\n #include <dirent.h>\n \n #include <rte_log.h>\n+#include <rte_bus.h>\n #include <rte_pci.h>\n #include <rte_eal_memconfig.h>\n #include <rte_malloc.h>\n@@ -723,3 +724,14 @@ rte_eal_pci_init(void)\n \n \treturn 0;\n }\n+\n+struct rte_pci_bus rte_pci_bus = {\n+\t.bus = {\n+\t\t.scan = rte_eal_pci_scan,\n+\t\t.probe = rte_eal_pci_probe,\n+\t},\n+\t.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),\n+\t.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),\n+};\n+\n+RTE_REGISTER_BUS(PCI_BUS_NAME, rte_pci_bus.bus);\n", "prefixes": [ "dpdk-dev", "v11", "09/13" ] }{ "id": 19765, "url": "