Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/17195/?format=api
https://patches.dpdk.org/api/patches/17195/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1479929804-19614-7-git-send-email-benjamin.walker@intel.com/", "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": "<1479929804-19614-7-git-send-email-benjamin.walker@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1479929804-19614-7-git-send-email-benjamin.walker@intel.com", "date": "2016-11-23T19:36:43", "name": "[dpdk-dev,6/7] pci: Combine rte_eal_pci_scan and rte_eal_pci_probe", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "eda37d0028af7e38c2c5534daa3322e0e0b4e72d", "submitter": { "id": 487, "url": "https://patches.dpdk.org/api/people/487/?format=api", "name": "Walker, Benjamin", "email": "benjamin.walker@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1479929804-19614-7-git-send-email-benjamin.walker@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/17195/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/17195/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 2CA4C5936;\n\tWed, 23 Nov 2016 20:37:27 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 4C855558D\n\tfor <dev@dpdk.org>; Wed, 23 Nov 2016 20:36:50 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP; 23 Nov 2016 11:36:47 -0800", "from bwalker-desk.ch.intel.com ([143.182.137.60])\n\tby fmsmga001.fm.intel.com with ESMTP; 23 Nov 2016 11:36:47 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.31,539,1473145200\"; d=\"scan'208\";\n\ta=\"1072691988\"", "From": "Ben Walker <benjamin.walker@intel.com>", "To": "dev@dpdk.org", "Cc": "Ben Walker <benjamin.walker@intel.com>", "Date": "Wed, 23 Nov 2016 12:36:43 -0700", "Message-Id": "<1479929804-19614-7-git-send-email-benjamin.walker@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1479929804-19614-1-git-send-email-benjamin.walker@intel.com>", "References": "<1479929804-19614-1-git-send-email-benjamin.walker@intel.com>", "Subject": "[dpdk-dev] [PATCH 6/7] pci: Combine rte_eal_pci_scan and\n\trte_eal_pci_probe", "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": "Two functions is both confusing and unnecessary. Previously,\nrte_eal_pci_scan populated an internal list of devices by\nscanning sysfs. Then, rte_eal_pci_probe would match registered\ndrivers to that internal list. These are not really useful\noperations to perform separately independently, though, so\nsimplify the api down to just rte_eal_pci_probe which can\nbe called repeatedly through the lifetime of the application\nto scan for new or removed PCI devices and load or unload\ndrivers as required.\n\nSigned-off-by: Ben Walker <benjamin.walker@intel.com>\n---\n app/test/test_pci.c | 2 +-\n lib/librte_eal/bsdapp/eal/eal.c | 3 ---\n lib/librte_eal/bsdapp/eal/eal_pci.c | 17 +----------------\n lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 -\n lib/librte_eal/common/eal_common_pci.c | 7 +++++++\n lib/librte_eal/common/eal_private.h | 14 +++++---------\n lib/librte_eal/common/include/rte_pci.h | 17 +++++------------\n lib/librte_eal/linuxapp/eal/eal.c | 3 ---\n lib/librte_eal/linuxapp/eal/eal_pci.c | 18 +-----------------\n lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 -\n 10 files changed, 20 insertions(+), 63 deletions(-)", "diff": "diff --git a/app/test/test_pci.c b/app/test/test_pci.c\nindex cda186d..fdd84f7 100644\n--- a/app/test/test_pci.c\n+++ b/app/test/test_pci.c\n@@ -180,7 +180,7 @@ test_pci_setup(void)\n \t\tTAILQ_INSERT_TAIL(&real_pci_device_list, dev, next);\n \t}\n \n-\tret = rte_eal_pci_scan();\n+\tret = rte_eal_pci_probe();\n \tTEST_ASSERT_SUCCESS(ret, \"failed to scan PCI bus\");\n \trte_eal_pci_dump(stdout);\n \ndiff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 35e3117..fd44528 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -561,9 +561,6 @@ rte_eal_init(int argc, char **argv)\n \tif (rte_eal_timer_init() < 0)\n \t\trte_panic(\"Cannot init HPET or TSC timers\\n\");\n \n-\tif (rte_eal_pci_init() < 0)\n-\t\trte_panic(\"Cannot init PCI\\n\");\n-\n \teal_check_mem_on_local_socket();\n \n \tif (eal_plugins_init() < 0)\ndiff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c\nindex 8b3ed88..6c3a169 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_pci.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c\n@@ -361,7 +361,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)\n * list. Call pci_scan_one() for each pci entry found.\n */\n int\n-rte_eal_pci_scan(void)\n+pci_scan(void)\n {\n \tint fd;\n \tunsigned dev_count = 0;\n@@ -667,18 +667,3 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)\n \n \treturn ret;\n }\n-\n-/* Init the PCI EAL subsystem */\n-int\n-rte_eal_pci_init(void)\n-{\n-\t/* for debug purposes, PCI can be disabled */\n-\tif (internal_config.no_pci)\n-\t\treturn 0;\n-\n-\tif (rte_eal_pci_scan() < 0) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): Cannot scan PCI bus\\n\", __func__);\n-\t\treturn -1;\n-\t}\n-\treturn 0;\n-}\ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 2f81f7c..67c469c 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -44,7 +44,6 @@ DPDK_2.0 {\n \trte_eal_pci_probe;\n \trte_eal_pci_probe_one;\n \trte_eal_pci_register;\n-\trte_eal_pci_scan;\n \trte_eal_pci_unregister;\n \trte_eal_process_type;\n \trte_eal_remote_launch;\ndiff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c\nindex 4f8c3a0..62b996d 100644\n--- a/lib/librte_eal/common/eal_common_pci.c\n+++ b/lib/librte_eal/common/eal_common_pci.c\n@@ -81,6 +81,7 @@\n #include <rte_devargs.h>\n \n #include \"eal_private.h\"\n+#include \"eal_internal_cfg.h\"\n \n struct pci_driver_list pci_driver_list =\n \tTAILQ_HEAD_INITIALIZER(pci_driver_list);\n@@ -423,6 +424,12 @@ rte_eal_pci_probe(void)\n \tint probe_all = 0;\n \tint ret = 0;\n \n+\tif (internal_config.no_pci) {\n+\t\treturn 0;\n+\t}\n+\n+\tpci_scan();\n+\n \tif (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0)\n \t\tprobe_all = 1;\n \ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 9e7d8f6..54f18ea 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -108,18 +108,14 @@ int rte_eal_timer_init(void);\n */\n int rte_eal_log_init(const char *id, int facility);\n \n-/**\n- * Init the PCI infrastructure\n+struct rte_pci_driver;\n+struct rte_pci_device;\n+\n+/* Scan the PCI bus for devices\n *\n * This function is private to EAL.\n- *\n- * @return\n- * 0 on success, negative on error\n */\n-int rte_eal_pci_init(void);\n-\n-struct rte_pci_driver;\n-struct rte_pci_device;\n+int pci_scan(void);\n \n /**\n * Update a pci device object by asking the kernel for the latest information.\ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 5d0feac..2154a54 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -386,20 +386,13 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__)\n void rte_eal_pci_unregister(struct rte_pci_driver *driver);\n \n /**\n- * Scan the content of the PCI bus, and the devices in the devices\n- * list\n- *\n- * @return\n- * 0 on success, negative on error\n- */\n-int rte_eal_pci_scan(void);\n-\n-/**\n- * Probe the PCI bus for registered drivers.\n+ * Scan the PCI bus for devices and match them to their driver.\n *\n * Scan the content of the PCI bus, and call the probe() function for\n- * all registered drivers that have a matching entry in its id_table\n- * for discovered devices.\n+ * all registered drivers that have a matching entry in their id_table.\n+ * If a device already has a driver loaded, probe will not be called.\n+ * If a previously discovered device is no longer present on the system,\n+ * the associated driver's remove() callback will be called.\n *\n * @return\n * - 0 on success.\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 2075282..f47f361 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -802,9 +802,6 @@ rte_eal_init(int argc, char **argv)\n \tif (rte_eal_log_init(logid, internal_config.syslog_facility) < 0)\n \t\trte_panic(\"Cannot init logs\\n\");\n \n-\tif (rte_eal_pci_init() < 0)\n-\t\trte_panic(\"Cannot init PCI\\n\");\n-\n #ifdef VFIO_PRESENT\n \tif (rte_eal_vfio_setup() < 0)\n \t\trte_panic(\"Cannot init VFIO\\n\");\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex f237864..663e106 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -479,7 +479,7 @@ parse_pci_addr_format(const char *buf, int bufsize, struct rte_pci_addr *addr)\n * list\n */\n int\n-rte_eal_pci_scan(void)\n+pci_scan(void)\n {\n \tstruct dirent *e;\n \tDIR *dir;\n@@ -806,19 +806,3 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)\n \n \treturn ret;\n }\n-\n-/* Init the PCI EAL subsystem */\n-int\n-rte_eal_pci_init(void)\n-{\n-\t/* for debug purposes, PCI can be disabled */\n-\tif (internal_config.no_pci)\n-\t\treturn 0;\n-\n-\tif (rte_eal_pci_scan() < 0) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): Cannot scan PCI bus\\n\", __func__);\n-\t\treturn -1;\n-\t}\n-\n-\treturn 0;\n-}\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex 83721ba..856728e 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -44,7 +44,6 @@ DPDK_2.0 {\n \trte_eal_pci_probe;\n \trte_eal_pci_probe_one;\n \trte_eal_pci_register;\n-\trte_eal_pci_scan;\n \trte_eal_pci_unregister;\n \trte_eal_process_type;\n \trte_eal_remote_launch;\n", "prefixes": [ "dpdk-dev", "6/7" ] }{ "id": 17195, "url": "